query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
POST /ticketrezs POST /ticketrezs.xml | def create
respond_to do |format|
if @ticketrez.save
flash[:notice] = 'Ticketrez was successfully created.'
format.html { redirect_to(@ticketrez) }
format.xml { render :xml => @ticketrez, :status => :created, :location => @ticketrez }
else
format.html { render :action => "new" }
format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketrezs }\n end\n end",
"def test_solveticket\n\n # create ticket\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', \"[email protected]\")\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match('http://rateitindia.zendesk.com'))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n end",
"def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end",
"def create\n @ticket = OTRS::Ticket.new(params[:ticket])\n\n respond_to do |wants|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n wants.html { redirect_to(@ticket) }\n wants.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n wants.json { render :json => @ticket, :status => :created, :location => @ticket }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n wants.json { render :json => @ticket.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n n = params[:number_of_tickets].to_i\n\n # make sure there are enough tickets\n\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n @ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{@ticket.id}\"\n @ticket.van.seats_available -= 1\n @ticket.van.save\n @ticket.save\n Recipt.send_recipt(@ticket).deliver\n (n-1).times do\n ticket = Ticket.new(ticket_params)\n ticket.save\n ticket.qrcode = \"http://gnome2home.herokuapp.com/scan/ticket?ticket_id=#{ticket.id}\"\n ticket.van.seats_available -= 1\n ticket.van.save\n ticket.save\n Recipt.send_recipt(ticket).deliver\n end\n\n if n == 1\n format.html { redirect_to @ticket, notice: 'Thank you for riding Gnome2Home. You will receive an email shortly with your QR code and confirmation number' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { redirect_to edit_passenger_registration_path, notice: \"Thanks for buying #{n} tickets. You can view all of you purchased tickets below. You will receive #{n} separate emails, each with a unique QR code ticket. Please keep those emails to check in. \"}\n format.json { render :show, status: :created, location: @ticket }\n end\n\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end",
"def createticketxml(descriptiontext, priorityid, requesternametext, requesteremail)\n ticketxml = Document.new\n ticketxml.add_element(\"ticket\")\n description = Element.new(\"description\")\n description.text = descriptiontext\n ticketxml.root.add_element(description)\n priority = Element.new(\"priority-id\")\n priority.text = priorityid\n ticketxml.root.add_element(priority)\n requestername = Element.new(\"requester-name\")\n requestername.text = requesternametext\n ticketxml.root.add_element(requestername)\n email = Element.new(\"requester-email\")\n email.text = requesteremail\n ticketxml.root.add_element(email)\n\n return ticketxml\n\n end",
"def test_createticket\n\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', \"[email protected]\")\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match('http://rateitindia.zendesk.com'))\n\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def post_ticket(params)\n ticket = Lighthouse::Ticket.new(:project_id => project_id)\n ticket.title = params[:title]\n ticket.body = params[:body]\n ticket.tags = params[:tags]\n ticket.save\n end",
"def create\n @tickets = []\n order_number = 1\n order_number = Ticket.last.order_number + 1 unless Ticket.all.count == 0\n number_of_tickets = params[:number_of_tickets].to_i\n\n number_of_tickets.times do |num|\n @tickets[num] = Ticket.new(ticket_params)\n @tickets[num].number_of_tickets = n = params[:number_of_tickets]\n @tickets[num].amount_paid = (n.to_i)*10 - 20*((n.to_i)/12)\n @tickets[num].order_number = order_number\n @tickets[num].location = current_admin.event.name if current_admin && current_admin.event\n unless @tickets[num].payment_type\n @tickets[num].payment_type = params[:payment_type]\n end\n end\n\n @ticket = @tickets.first\n if @ticket.save\n @tickets.each do |ticket|\n ticket.save\n end\n Recipt.ticket_recipt(@ticket).deliver\n redirect_to ticket_path(@ticket), notice: \"Thank you for buying #{pluralize(number_of_tickets, 'raffle ticket')} #{@ticket.first_name}\"\n else\n render :new if current_admin\n render :new_wepay if !current_admin\n end\n end",
"def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end",
"def to_xml\n xml = \"<ticket>\\n\"\n xml << \"\\t<subject>#{@subject}</subject>\\n\"\n xml << \"\\t<description>#{@description}</description>\\n\"\n xml << \"\\t<requester-name>#{@requester_name}</requester-name>\\n\"\n xml << \"\\t<requester-email>#{@requester_email}</requester-email>\\n\"\n xml << \"\\t<set-tags>#{@tags}</set-tags>\\n\"\n xml << \"</ticket>\"\n return xml\n end",
"def createNewTicket(description=0, requesterid=0)\n\n # make a default description if none is provided\n if description == 0\n description = \"Default description in a test at \" + Time.new.to_s()\n end\n\n #Post the request to the server\n resp = @@conn.post do |req|\n req.url '/tickets.xml'\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a class param\n req.headers['Content-Type'] = 'application/xml'\n req.body = \"<ticket><description>\"+ description.to_s() +\"</description><requester_id>\"+ requesterid.to_s() +\"</requester_id></ticket>\"\n end\n\n #Formating the return\n returnXML = resp['location'].to_s()\n returnXML.slice! \"http://sellert.zendesk.com/api/v1\"\n\n return returnXML\n end",
"def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend",
"def createsolvedticketxml(assignee_id)\n\n closeticketxml = Document.new\n closeticketxml.add_element(\"ticket\")\n assignee = Element.new(\"assignee-id\")\n assignee.text = assignee_id\n closeticketxml.root.add_element(assignee)\n\n # id of a closed ticket is 3\n status = Element.new(\"status-id\")\n status.text = 3\n closeticketxml.root.add_element(status)\n return closeticketxml # explict return to return the entire xml\n end",
"def create\n @tickets = []\n params[:quantity].to_i.times do\n @ticket = Ticket.new(params[:ticket])\n @ticket.viber = current_viber\n @tickets << @ticket\n end\n\n respond_to do |format|\n if @tickets.map(&:save)\n format.html { redirect_to @ticket, notice: 'Your ticket(s) are booked.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie utworzony.') }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to(@ticket) }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end",
"def create\n \n @ticket = Ticket.new(params[:ticket])\n @ticket.ticket_status_id = 1\n @ticket.requestor_id = current_user.id\n @ticket.account_id = current_user.company.account_id\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully created.') }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_ticket\n jiraPair = @defect.getJiraList\n mapping = jiraAPIMapping\n payload = {\n :fields =>\n {:project =>\n {:key => \"#{jiraPair['Project']}\"},\n :summary => jiraPair['Summary'] + \" (#{@defect.get_story})\",\n :description => Sanitize.clean(jiraPair['Description']),\n mapping['Release Milestone'] => {:value => jiraPair['Release Milestone']},\n :customfield_10143 => [{:value => jiraPair['Environment'],}],\n :issuetype => {:name => jiraPair['issuetype']},\n mapping['Functional Group'] => {:value => jiraPair['Functional Group']},\n mapping['Project Manager'] => {:value => jiraPair['Project Manager']},\n :versions => [{:name => \"#{jiraPair['Release']}\",}],\n },\n }\n\n response = self.class.post('/rest/api/latest/issue/',\n :body => payload.to_json,\n :headers => {'Content-Type' => 'application/json' },\n :verify => false)\n\n url = \"\"\n if response['key']\n url = $JIRA['base_uri'] + \"/browse/\" + response['key']\n @defect.setJiraLink(url)\n else\n errormsg = \"Error (#{@defect.get_story}): #{response}\"\n p errormsg\n @defect.setDefectError(errormsg)\n end\n\n return url\n end",
"def create_ticket_request(subject, description)\n request = Nokogiri::XML::Builder.new do |xml|\n xml.Operation {\n xml.Details {\n xml.parameter {\n xml.name {\n xml.text 'requester'\n }\n xml.value {\n xml.text @servicedesk_data[:requestor]\n }\n }\n xml.parameter {\n xml.name {\n xml.text 'Group'\n }\n xml.value {\n xml.text @servicedesk_data[:group]\n }\n }\n xml.parameter {\n xml.name {\n xml.text 'subject'\n }\n xml.value {\n xml.text subject\n }\n }\n xml.parameter {\n xml.name {\n xml.text 'description'\n }\n xml.value {\n xml.cdata description\n }\n }\n }\n }\n end\n return request.to_xml\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n @ticket.ticket_status = 'Waiting for Staff Response'\n @ticket.ticket_interface = 'New unassigned tickets'\n @ticket.make_uniq_reference\n\n TicketConfirmingMailer.new_ticket_confirmation(@ticket).deliver\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n response = HTTParty.post(servlet_url,\n :body => to_xml,\n :headers => { 'Content-Type' => 'application/xml' }\n ).response\n\n return Dhl::Shipment::Response.new(response.body)\n rescue Exception => e\n request_xml = if @to_xml.to_s.size>0\n @to_xml\n else\n '<not generated at time of error>'\n end\n\n response_body = if (response && response.body && response.body.to_s.size > 0)\n response.body\n else\n '<not received at time of error>'\n end\n\n log_level = if e.respond_to?(:log_level)\n e.log_level\n else\n :critical\n end\n\n log_request_and_response_xml(log_level, e, request_xml, response_body )\n raise e\n end",
"def index\n @tickets = Ticket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def create\n ticket_params.inspect\n @ticket = Ticket.new(ticket_params)\n @ticket.user = nil\n @ticket.status = \"for_sale\"\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def create\n @ticket = Ticket.find(params[:ticket_action][:ticket_id])\n# logger.debug(@ticket.to_yaml)\n @ticket_action = @ticket.ticket_actions.build(params[:ticket_action])\n\n respond_to do |format|\n if @ticket_action.save\n flash[:notice] = 'TicketAction was successfully created.'\n format.html { redirect_to(@ticket_action) }\n format.xml { render :xml => @ticket_action, :status => :created, :location => @ticket_action }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket_action.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n \n #Security check. You can only add a ticket for an event you also created!´\n \n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to tickets_path() }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n flash[:notice_bad] = 'Please fill in all required fields.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n respond_to do |format|\n if @ticket.save\n format.html { render json: @ticket.to_json }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params_create)\n\n respond_to do |format|\n if @ticket.save\n TicketMailer.send_ticket_status(@ticket).deliver_later\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Build a ticket associated with the current user and fill with strong parameters\n @ticket = current_user.help_requests.build(ticket_params)\n # New Hash\n add_info = {}\n # New Nested Array\n add_info[:tagged_users] = []\n # Scan for tagged users in the report:\n @ticket.desc.scan(USER_TAG_REGEX) do |name|\n # Find a tagged user in the database\n user = User.find_by_name(name)\n # Add the tagged user to the hash of tagged users\n add_info[:tagged_users] << user.name unless user == nil\n end\n # Save a JSON representation of the add_info hash to the record\n @ticket.addinfo = JSON.generate(add_info)\n # Save the new record in the database\n @ticket.save\n # Send the user to their homepage\n redirect_to me_path\n end",
"def ticket_params\n params.require(:ticket).permit(:request_number, :sequence_number, :request_type, \n \t:response_due_date_time, :primary_service_area_code, :additional_service_area_code, :well_known_text)\n end",
"def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n \n respond_to do |format|\n if @ticket.save\n format.html { redirect_to ticket_path( @ticket ), notice: '感謝您參與本次活動,我們將於 10 個工作日回覆您!' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_recipt(ticket)\n @ticket = ticket\n\n mail to: ticket.email\n end",
"def index\n @ticket_actions = TicketAction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_actions }\n end\n end",
"def create_ticket(ticket)\n if ticket.priority.nil? or ticket.project_id.nil? or ticket.summary.nil?\n raise Unfuddled::Error.new(\"Must have Priority (1..5), Project ID and Summary\")\n end\n\n begin\n url = \"/api/v1/projects/#{ticket.project_id}/tickets.json\"\n id = send(:post , url, ticket.to_h)[:body][:id]\n \n # Add the ID with to ticket\n ticket.id = id\n\n # Attach the client to the ticket\n ticket.client = self\n \n ticket\n rescue Unfuddled::HTTPErrorResponse => error\n raise error\n end\n\n end",
"def create\n @ticket = Ticket.new(ticket_params)\np \"ticket_params: #{ticket_params}\"\n respond_to do |format|\n if @ticket.errors.size == 0 && @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n # user_id = params[\"user_id\"]\n user_id = @user.id\n store_id = params[\"store_id\"]\n \n @ticket = Ticket.new\n @ticket.user_id = user_id\n @ticket.store_id = store_id\n @ticket.cnt = get_new_ticket_number (store_id)\n\n respond_to do |format|\n if @ticket.save\n @newTicket = TicketsHelper::Ticket.new\n @newTicket.store_id = @ticket.store.id\n @newTicket.store_name = @ticket.store.name\n @newTicket.reg_time = @ticket.created_at\n @newTicket.wait_number = @ticket.cnt\n @newTicket.wait_ahead_count = get_current_user_wait_ahead_count(@ticket)\n \n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show}\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_ticket(ticket)\n @ticket = ticket\n\n mail :to => \"[email protected]\", \n :subject => \"Ticket: \" + ticket.id.to_s,\n :reply_to => \"[email protected]\"\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def test_articlerss\n get :articlerss, :id => 1 \n assert_response :success\n assert_nothing_raised do\n assert REXML::Document.new(@response.body)\n end\n end",
"def create\n #@matches = Match.all\n\n @ticket = current_fan.tickets.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n @ticket.project = @project\n @ticket.owner = current_user\n respond_to do |format|\n if @ticket.save\n TicketMailer.ticket_created(@ticket).deliver \n format.html { redirect_to([@project, @ticket], :notice => 'Ticket was successfully created.') }\n format.xml { render :xml => @ticket, :status => :created, :location => @ticket }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @support_ticket = SupportTicket.new(support_ticket_params)\n\n respond_to do |format|\n if @support_ticket.save\n format.html { redirect_to @support_ticket, notice: 'Support ticket was successfully created.' }\n format.json { render :show, status: :created, location: @support_ticket }\n else\n format.html { render :new }\n format.json { render json: @support_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:ano, :mes, :processo_numero, :solicitacao_data, :solicitacao_hora, :solicitacao_descricao, :solicitacao_regional, :solicitacao_bairro, :solicitacao_localidade, :solicitacao_endereco, :solicitacao_roteiro, :rpa_codigo, :rpa_nome, :solicitacao_microrregiao, :solicitacao_plantao, :solicitacao_origem_chamado, :latitude, :longitude, :solicitacao_vitimas, :solicitacao_vitimas_fatais, :solicitacao_vitimas_fatais, :processo_tipo, :processo_origem, :processo_localizacao, :processo_status, :processo_data_conclusao)\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def expose(xml, tickets)\n seen = []\n Kernel.loop do\n puzzles = xml.xpath(\n [\n '//puzzle[@alive=\"false\" and issue',\n 'and issue != \"unknown\" and not(issue/@closed)',\n seen.map { |i| \"and id != '#{i}'\" }.join(' '),\n ']'\n ].join(' ')\n )\n break if puzzles.empty?\n puzzle = puzzles[0]\n puzzle.search('issue')[0]['closed'] = Time.now.iso8601 if tickets.close(puzzle)\n save(xml)\n end\n seen = []\n Kernel.loop do\n puzzles = xml.xpath(\n [\n '//puzzle[@alive=\"true\" and (not(issue) or issue=\"unknown\")',\n seen.map { |i| \"and id != '#{i}'\" }.join(' '),\n ']'\n ].join(' ')\n )\n break if puzzles.empty?\n puzzle = puzzles[0]\n id = puzzle.xpath('id')[0].text\n seen << id\n issue = tickets.submit(puzzle)\n next if issue.nil?\n puzzle.search('issue').remove\n puzzle.add_child(\n \"<issue href='#{issue[:href]}'>#{issue[:number]}</issue>\"\n )\n save(xml)\n end\n end",
"def ticket_params\n params.require(:ticket).permit(:support_request, :status, :closed_at, :customer_id, :support_agent_id)\n end",
"def create\n \n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_report dep_name, user, vars, log\n require 'net/http'\n require 'uri'\n\n returning(Net::HTTP.post_form(\n URI.parse('http://gist.github.com/api/v1/xml/new'),\n {\n \"files[from]\" => user,\n \"files[vars.yml]\" => vars,\n \"files[#{dep_name}.log]\" => log.decolorize\n }\n )) do |response|\n report_report_result dep_name, response\n end.is_a? Net::HTTPSuccess\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def ticket_params\n params.require(:ticket).permit(:ref, :command, :reservation, :resaDate, :resaTime, :price, :accessDate, :accessTime, :tarif, :type, :serie, :floor, :sellPoint)\n end",
"def update\n respond_to do |format|\n if @ticketrez.update_attributes(params[:ticketrez])\n flash[:notice] = 'Ticketrez was successfully updated.'\n format.html { redirect_to(@ticketrez) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n @ticket.from_email = current_user.email\n @ticket.user_id = current_user.id\n\n respond_to do |format|\n if @ticket.save\n zt = ZendeskTicket.new(@ticket.platform)\n zt.build(@ticket, request.base_url)\n zd_ticket = zt.create\n @ticket.zendesk_ticket_id = zd_ticket.id\n @ticket.save\n\n msg = 'Your ticket was successfully created'\n\n format.html { redirect_to @ticket, notice: msg}\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def index\n @tickets = OTRS::Ticket.where(params[:q])\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @tickets }\n wants.json { render :json => @tickets }\n end\n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n @ticket.previous_assignee_id = nil\n @ticket.updater_id = session[:user]\n \n respond_to do |format|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created.'\n format.html { redirect_to @coll_url }\n format.xml { head :created, :location => ticket_url(@ticket) }\n else\n @content_title = @title = @ticket.asset.nil? ? 'Editing new ticket' : \"Editing new ticket for #{a.title}\"\n @submit_value = 'Create'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket.errors.to_xml }\n end\n end\n end",
"def create\n @ticket = @project.tickets.new(ticket_params)\n @ticket.reporter = @current_user\n\n respond_to do |format|\n if @ticket.save\n # User should auto-subscribe to tickets they create\n begin\n Subscription.create(user: @current_user, ticket: @ticket).save!\n rescue\n end\n format.html { redirect_to @ticket }\n format.json { render :show, status: :created, location: @ticket }\n else\n logger.debug @ticket.errors.inspect\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @ticket_detalle = TicketDetalle.new(ticket_detalle_params)\n\n respond_to do |format|\n if @ticket_detalle.save\n format.html { redirect_to ticket_path(@ticket_detalle.ticket_id), notice: 'Ticket detalle was successfully created.' }\n format.json { render :show, status: :created, location: @ticket_detalle }\n else\n format.html { render :new }\n format.json { render json: @ticket_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: \"Ticket was successfully created.\" }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sru_response\n # Create bib record.\n title_str = OLE_QA::Framework::String_Factory.alphanumeric(12)\n author_str = OLE_QA::Framework::String_Factory.alphanumeric(14)\n today = Time.now.strftime('%Y%m%d-%H%M')\n bib_ary = [{\n :tag => '245',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + title_str\n },\n {\n :tag => '100',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + author_str\n }]\n bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(@ole)\n bib_editor.open\n create_bib(bib_editor,bib_ary)\n query = \"title any #{title_str}\"\n filename = \"sru_perf-#{today}.xml\"\n get_sru_file(query,filename,@ole)\n records = get_marc_xml(filename)\n verify(5) {File.zero?(\"data/downloads/#{filename}\") == false}\n verify(5) {records.count == 1}\n end",
"def ticketexport tid,count\n\n begin\n ticket = ZendeskAPI::Ticket.find($client, :id => tid, :include => :users)\n rescue\n puts \"The call to the Zendesk API failed for ticket #{tid}, moving on.\"\n end\n\n if ticket.nil?\n puts \"No ticket at #{tid}\"\n return\n elsif ticket.organization.nil?\n puts \"No organization on ticket #{tid}\"\n return\n elsif ticket.requester.nil?\n puts \"No requester on ticket #{tid}\"\n return\n #elsif ticket.status.to_s != \"closed\" \n # puts \"Ticket status is not closed\"\n # return\n end\n\n\n #if ticket.requester.nil?\n # return \"No requester on ticket #{tid}\"\n #else ticket.organization.nil?\n # return \"No organization on ticket #{tid}\"\n #end\n puts ticket.id\n puts ticket.to_json\n\n #puts ticket.status\n #puts ticket.url\n #puts ticket.date\n puts \"Company: #{ticket.organization.name}\"\n puts \"Requester: #{ticket.requester.name}\"\n puts \"Requester Email: #{ticket.requester.email}\"\n puts \"Requester Alias: #{ticket.requester.alias}\"\n #puts ticket.subject\n #puts ticket.description\n\n ctime = Time.parse(\"#{ticket.created_at}\")\n cdate = ctime.in_timezone 'America/Chicago'\n cwtime = ctime.strftime(\"%m/%d/%Y\")\n\n #puts cdate\n begin\n audits = ticket.audits.each\n rescue\n puts \"Collecting audits failed, trying again in 30 seconds.\"\n sleep 30\n audits = ticket.audits.each\n end\n # puts audits.to_json\n # This is a UNC PATH where we will put all of the files\n # On a Windows server.\n # This is NOT ideal, but is a side effect of using a janky import process.\n # It works, but it's a dirty hack.\n path = '\\\\\\\\share.somedomain.com\\cw\\\\'\n\n $pubc = \"\\n\\n################################\\n\\nThese were Zendesk Public Comments.\\n\\n\"\n $pubc << \"Zendesk Ticket URL: https://zen.somedomain.com/tickets/#{ticket.id}\\n\\n\"\n $privc = \"\\n\\n################################\\n\\nThese Were Zendesk Private Comments.\\n\\n\"\n # $pubc << \"Full text: #{path}#{ticket.id}\\\\FullThread.txt\\n\\n\"\n \n\n\n audits.each do |i|\n \n t = Time.parse(\"#{i.created_at}\")\n $localtime = t.in_timezone 'America/Chicago'\n $endtime = t.strftime(\"%m/%d/%Y\")\n i.events.each do |e|\n #if e.body =~ /Ticket \\{\\{ticket\\.id\\}\\}/\n #puts e.attachments\n if e.attachments\n if ! File.directory?(\"./cw/#{ticket.id}\")\n dir = Dir.mkdir(\"./cw/#{ticket.id}\")\n #dir = Dir.mkdir(\"./cw/#{ticket.id}/msgs\")\n end\n e.attachments.each do |att|\n begin\n afile = att.file_name.gsub(/\\//, '-')\n afile = afile.gsub(/^\\./, '')\n puts afile\n $pubc << \"\\n\\nAttachment: #{path}#{ticket.id}\\\\#{afile}\\n\\n\"\n # File.write(\"./cw/#{ticket.id}/#{att.file_name}\", Net::HTTP.get(URI.parse(\"#{att.content_url}\"))) \n File.write(\"./cw/#{ticket.id}/#{afile}\", fetchData(\"#{att.content_url}\"))\n rescue\n puts \"There was a problem writing the attachment #{afile}\"\n end\n end\n end \n if e.type.to_s == \"Comment\"\n if e.public.to_s == 'false'\n # puts \"This is a \" + ( e.public.to_s == 'false' ? \"PRIVATE comment.\\n\" : \"PUBLIC comment.\\n\" )\n $privc << \"\\n\\n################################\\n\\n\"\n $privc << \"At #{$localtime}, #{i.author.email} said:\\n\\n\" rescue \"There was an error here\"\n #out = e.body[0..30000]\n $privc << e.body\n #if e.attachments\n else\n # puts \"This is a \" + ( e.public.to_s == 'false' ? \"PRIVATE comment.\\n\" : \"PUBLIC comment.\\n\" )\n $pubc << \"\\n\\n################################\\n\\n\"\n $pubc << \"At #{$localtime}, #{i.author.email} said:\\n\\n\" rescue \"There was an error here\"\n #out = e.body[0..30000]\n $pubc << e.body\n $pubc + \"\\n\\n\"\n \n end\n\n else\n next\n end\n end \n end\n\n $pubc << ticket.description\n # Per connectwise, we have to strip out the pipes from the descriptions\n $privc.gsub!('|','*pipe character was removed here*')\n #puts $privc\n\n $pubc.gsub!('|', '*pipe character was removed here*')\n #puts $pubc\n\n #puts $privc\n #puts $pubc\n\n #fulltext = FILE.open(\"./cw/#{ticket.id}/FullThread.txt\", \"w\") do |ffile|\n # ffile << $privc\n # ffile <<pubc\n #end\n\n headers = %w{SrBoard CompanyName ContactName SrStatus SrType SrSubType SrItem SrSource SrLocation SrPriority Summary DetailDescription InternalAnalysis Resolution AssignedBy DateEntered DateCompleted ConfigName ResourceMember}\n\n output = [{\n 'SrBoard' => \"Service Desk\",\n 'CompanyName' => \"#{ticket.organization.name}\",\n 'ContactName' => \"#{ticket.requester.alias}\",\n 'SrStatus' => \"Closed\",\n 'SrType' => \"\",\n 'SrSubType' => \"\",\n 'SrItem' => \"\",\n 'SrSource' => \"Zendesk\",\n 'SrLocation' => \"Remote\",\n 'SrPriority' => \"Priority 5 - No SLA\",\n 'Summary' => \"#{ticket.subject}\",\n 'DetailDescription' => \"#{$pubc}\",\n 'InternalAnalysis' => \"#{$privc}\",\n 'Resolution' => \"\",\n 'AssignedBy' => \"zadmin\",\n 'DateEntered' => \"#{cwtime}\",\n 'DateCompleted' => \"#{$endtime}\",\n 'ConfigName' => \"\",\n 'ResourceMember' => \"\"\n }]\n\n cols = output.first.keys\n excsv cols,output,count,tid\nend",
"def create\n respond_to do |format|\n if @support_ticket.save\n format.html { redirect_to @support_ticket, notice: 'Support ticket was successfully created.' }\n format.json { render json: @support_ticket, status: :created, location: @support_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @support_ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = current_user.user_tries.last.tickets.build(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n current_user.user_tries.last.state_machine.transition_to(:recruit)\n format.html { redirect_to root_path, notice: 'Ticket was successfully created.' }\n format.json { render :show, status: :created, location: @ticket }\n else\n format.html { render :new }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ticket\n end",
"def ticket_params\n params.require(:ticket).permit(:customer_name, :customer_email, :subject, :uniq_reference, :ticket_status, :ticket_interface, :ownership, :ticket_body, :response)\n end",
"def create\n\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_intervention_ticket\n #Call zendesk API create new client method\n client = ZendeskAPI::Client.new do |config|\n #Get config parameters from application.yml \n #These parameters are ignored by git \n config.url = ENV['ZENDESK_URL']\n config.username = ENV['ZENDESK_USERNAME']\n config.token = ENV['ZENDESK_TOKEN']\n end\n #create the ticket \n ZendeskAPI::Ticket.create!(client,\n #define subject with the current user name \n :subject => \"NEW INTERVENTION created by : \" + @currentusername.to_s ,\n #Requirements : \n # The Requester\n # The Customer (Company Name)\n # Building ID\n # The Battery ID\n # The Column ID if specified\n # Elevator ID if specified\n # The employee to be assigned to the task\n # Description of the request for intervention\n\n :comment => \"The customer ID : #{params[:customer]} \n Building ID : #{params[:building]} \n Battery ID : #{params[:battery]} \n Column ID : #{params[:column]} \n Elevator ID : #{params[:elevator]} \n Affected employee ID : #{params[:employee]} \n Description : #{params[:report]} \",\n #Set the priority \n :priority => \"urgent\",\n #Set the type \n :type => \"question\")\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def new\n @ticket = OTRS::Ticket.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @ticket }\n wants.json { render :json => @ticket }\n end\n end",
"def send_raw(xml)\n open\n @soap_client.ProcessRequest(@ticket, xml)\n close \n end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n UserMailer.welcome_email(@ticket).deliver\n format.html { redirect_to @ticket, notice: 'We received your query and answer you as soon as possible.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recordspreannt_params\n params.require(:recordspreannt).permit(:ticket_id, :n1, :n2, :siglas, :monto)\n end",
"def POST; end",
"def create\n @ticket = Ticket.new(params[:ticket])\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end",
"def search_for_new_reports(until_date=Date.today)\n\n url = \"http://www.fixmystreet.com/open311/v2/requests.xml?jurisdiction_id=fiksgatami.no&agency_responsible=2434%7C2240&start_date=#{(until_date - 14).strftime('%Y-%m-%d')}&end_date=#{until_date.strftime('%Y-%m-%d')}\"\n\n doc = Nokogiri::XML HTTParty.get(url).response.body\n\n rows = []\n count = 0\n\n doc.search('request').each do |i|\n rows << i.children.inject({}){|hsh,el| hsh[el.name] = el.inner_text;hsh}\n end\n\n rows.each do |row|\n\n if row[\"agency_responsible\"].strip == \"Staffordshire County Council\"\n subdomain = \"www\"\n else\n subdomain = \"lichfielddc\"\n end\n\n details = {\n :uid => row[\"service_request_id\"],\n :url => \"http://#{subdomain}.fixmystreet.com/report/#{row['service_request_id']}\",\n :council => row[\"agency_responsible\"].strip,\n :description => row[\"description\"],\n :detail => row[\"detail\"],\n :sent => Date.parse(row[\"agency_sent_datetime\"]),\n :lat => row[\"lat\"],\n :lng => row[\"long\"],\n :requested => Date.parse(row[\"requested_datetime\"]),\n :service => row[\"service_name\"],\n :title => row[\"title\"],\n :status => row[\"status\"],\n :updated => Date.parse(row[\"updated_datetime\"])\n }\n\n ScraperWiki.save([:uid], details)\n\n end\n\nend",
"def search_for_new_reports(until_date=Date.today)\n\n url = \"http://www.fixmystreet.com/open311/v2/requests.xml?jurisdiction_id=fiksgatami.no&agency_responsible=2434%7C2240&start_date=#{(until_date - 14).strftime('%Y-%m-%d')}&end_date=#{until_date.strftime('%Y-%m-%d')}\"\n\n doc = Nokogiri::XML HTTParty.get(url).response.body\n\n rows = []\n count = 0\n\n doc.search('request').each do |i|\n rows << i.children.inject({}){|hsh,el| hsh[el.name] = el.inner_text;hsh}\n end\n\n rows.each do |row|\n\n if row[\"agency_responsible\"].strip == \"Staffordshire County Council\"\n subdomain = \"www\"\n else\n subdomain = \"lichfielddc\"\n end\n\n details = {\n :uid => row[\"service_request_id\"],\n :url => \"http://#{subdomain}.fixmystreet.com/report/#{row['service_request_id']}\",\n :council => row[\"agency_responsible\"].strip,\n :description => row[\"description\"],\n :detail => row[\"detail\"],\n :sent => Date.parse(row[\"agency_sent_datetime\"]),\n :lat => row[\"lat\"],\n :lng => row[\"long\"],\n :requested => Date.parse(row[\"requested_datetime\"]),\n :service => row[\"service_name\"],\n :title => row[\"title\"],\n :status => row[\"status\"],\n :updated => Date.parse(row[\"updated_datetime\"])\n }\n\n ScraperWiki.save([:uid], details)\n\n end\n\nend",
"def create\n @cancellation = Cancellation.new_from_xml(request.body.read)\n respond_to do |format|\n if @cancellation.save! \n format.xml { render :action => 'show', :status => :created, :location => @cancellation }\n else\n format.xml { render :xml => @cancellation.errors, :status => :unprocessable_entity }\n end\n end \n \n #@orders.each do |order|\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ticket = Ticket.new(ticket_params)\n\n respond_to do |format|\n if @ticket.save\n format.html { redirect_to @ticket, notice: 'Ticket was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ticket }\n else\n format.html { render action: 'new' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize @ticket\n if @ticket.update_attributes(tag_list: @tags)\n render :json => @ticket.reload.tags, :status => :created\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def ticket_params\n params.require(:ticket).permit(:id, :title, :description, :status, \n :first_name, :last_name, :address, :city, :province, :postalcode, :department_id,\n :address_confirm, :user_id, :date_in, :country, :phone_number, :reporter_id, :user_id)\n end",
"def index\n @ticket_times = TicketTime.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_times }\n end\n end",
"def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end"
] | [
"0.60093135",
"0.59274554",
"0.5926637",
"0.57634854",
"0.5671913",
"0.56365573",
"0.56182146",
"0.55800855",
"0.55708873",
"0.55073446",
"0.5494406",
"0.5487749",
"0.5470839",
"0.5443514",
"0.54287803",
"0.54252005",
"0.5411759",
"0.5361338",
"0.5320741",
"0.53139126",
"0.53025466",
"0.52916807",
"0.5290139",
"0.5281043",
"0.522564",
"0.5224736",
"0.51992583",
"0.5195943",
"0.5194121",
"0.51937735",
"0.5164827",
"0.51428694",
"0.51365805",
"0.5134043",
"0.51042855",
"0.50978416",
"0.50886744",
"0.5083166",
"0.5075226",
"0.50735354",
"0.5067181",
"0.50602734",
"0.50481623",
"0.5045804",
"0.5043794",
"0.5042799",
"0.50405467",
"0.502924",
"0.50273305",
"0.5022842",
"0.5017218",
"0.5016621",
"0.5008994",
"0.5004006",
"0.50022495",
"0.4996408",
"0.49956325",
"0.4991721",
"0.4989558",
"0.49815103",
"0.49804062",
"0.49803907",
"0.49771324",
"0.4975205",
"0.49720958",
"0.4971086",
"0.49700427",
"0.49700427",
"0.49700427",
"0.49700427",
"0.49699393",
"0.49637565",
"0.49626425",
"0.49620947",
"0.49614528",
"0.4959657",
"0.49588114",
"0.49528036",
"0.49492782",
"0.49475273",
"0.4940236",
"0.49394116",
"0.49306834",
"0.49294144",
"0.49265102",
"0.49229753",
"0.4922913",
"0.49201632",
"0.49094662",
"0.4904181",
"0.49040455",
"0.49040455",
"0.48988405",
"0.4898548",
"0.4898548",
"0.4898476",
"0.48928204",
"0.48923033",
"0.48862",
"0.48860815"
] | 0.63700604 | 0 |
PUT /ticketrezs/1 PUT /ticketrezs/1.xml | def update
respond_to do |format|
if @ticketrez.update_attributes(params[:ticketrez])
flash[:notice] = 'Ticketrez was successfully updated.'
format.html { redirect_to(@ticketrez) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def test_solveticket\n\n # create ticket\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', \"[email protected]\")\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match('http://rateitindia.zendesk.com'))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n end",
"def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :edit }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket.update(ticket_params)\n\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to(@ticket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticketrezs }\n end\n end",
"def update\n respond_to do |wants|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n wants.html { redirect_to(@ticket) }\n wants.xml { head :ok }\n wants.json { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n wants.json { render :json => @ticket.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n format.html { redirect_to(@ticket, :notice => 'Bilet został pomyślnie zaktualizowany.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, '[email protected]', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end",
"def create\n respond_to do |format|\n if @ticketrez.save\n flash[:notice] = 'Ticketrez was successfully created.'\n format.html { redirect_to(@ticketrez) }\n format.xml { render :xml => @ticketrez, :status => :created, :location => @ticketrez }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticketrez.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\n # if open \n if params[:ticket][:ticket_status_id] == \"1\"\n \[email protected]_id = nil\n # if solved\n elsif params[:ticket][:ticket_status_id] == \"2\"\n \[email protected]_id = current_user.id\n \[email protected]_at = Time.now\n end\n \n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n \t\n format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ticket = Ticket.find(params[:id])\n @ticket.previous_assignee_id = @ticket.assignee_id\n @ticket.updater_id = session[:user]\n\n respond_to do |format|\n if @ticket.update_attributes(params[:ticket])\n flash[:notice] = 'Ticket was successfully updated.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket.errors.to_xml }\n end\n end\n end",
"def update\n logger.info { \"PARAMS: #{params.inspect}\" }\n project_id, id = params[:id].split('-')\n ticket = Lighthouse::Ticket.find(id, :params => {:project_id => project_id})\n \n # insanely hacky. can't nest json, so don't want to do a willy-nilly merge.\n # move mergeable params to the [:ticket] hash to follow usual rails conventions\n # before merging\n params[:ticket] = {}\n %w(assigned_user_id state milestone_id).each do |field|\n params[:ticket].merge!( field => params.delete(field) ) if params[field]\n end\n logger.info { \"TICKET ATTRS TO UPDATE: #{params[:ticket].inspect}\"}\n \n ticket.attributes.merge!( params[:ticket] )\n ticket.save\n\n respond_to do |format|\n # if @ticket.update_attributes(params[:ticket])\n # flash[:notice] = 'Ticket was successfully updated.'\n # format.html { redirect_to(@ticket) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @ticket_action = TicketAction.find(params[:id])\n\n respond_to do |format|\n if @ticket_action.update_attributes(params[:ticket_action])\n flash[:notice] = 'TicketAction was successfully updated.'\n format.html { redirect_to(@ticket_action) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ticket_action.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def update\n @ticket = Ticket.find(params[:id])\n\t\tchanges = \"\"\n\t\tnew_employee = params[:ticket][:employee_id].nil? || params[:ticket][:employee_id].empty? ? nil : Employee.find(params[:ticket][:employee_id])\n\t\tunless new_employee == @ticket.employee\n\t\t\tchanges += \"> Responsible changed from #{@ticket.employee ? @ticket.employee.login : \"None\"} to #{new_employee.login}\"\n\t\t\[email protected] = new_employee\n\t\tend\n\t\tnew_status = params[:ticket][:status_id].nil? || params[:ticket][:status_id].empty? ? nil : Status.find(params[:ticket][:status_id])\n\t\tunless new_status == @ticket.status\n\t\t\tchanges += $/ + \"> Status changed from \\\"#{@ticket.status ? @ticket.status.name : \"None\"}\\\" to \\\"#{new_status.name}\\\"\"\n\t\t\[email protected] = new_status\n\t\tend\n\t\t@reply = @ticket.replies.build(params[:reply])\n\t\[email protected] = changes\n\t\[email protected] = current_user.login\n respond_to do |format|\n if @ticket.valid? && @reply.valid?\n\t\t\t\[email protected]\n\t\t\t\[email protected]\n\t\t\t\tCustomerSupport.update_ticket_email(@ticket,@reply).deliver\n format.html { redirect_to backend_ticket_path(@ticket), notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ticket\n @ticket = Ticket.find(params[:ticket_id])\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render json: {status: :ok}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: \"Ticket was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end",
"def set_ticket\n @ticket = Ticket.friendly.find(params[:id])\n end",
"def set_ticket\n @ticket = params[:id].present? ? find_ticket(:id) : find_ticket(:ticket_id)\n end"
] | [
"0.6946197",
"0.6153371",
"0.6102849",
"0.6035696",
"0.58849657",
"0.5875967",
"0.5807095",
"0.5770786",
"0.5766481",
"0.5742938",
"0.5742938",
"0.57326156",
"0.57266366",
"0.57189256",
"0.5598665",
"0.55845714",
"0.5573273",
"0.55574924",
"0.552886",
"0.5515418",
"0.5451395",
"0.5451395",
"0.5451395",
"0.5451395",
"0.5451395",
"0.5451395",
"0.5451395",
"0.5451395",
"0.544791",
"0.5428626",
"0.5428471",
"0.5425066",
"0.5411273",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53991455",
"0.53954",
"0.5386818",
"0.53851616",
"0.53825456",
"0.53825456",
"0.53746915",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53639454",
"0.53633285",
"0.5357541",
"0.53535986",
"0.5347118",
"0.53453076"
] | 0.6567704 | 1 |
DELETE /ticketrezs/1 DELETE /ticketrezs/1.xml | def destroy
authorize! :destroy, Rezlineitem
@show = @ticketrez.show
@ticketrez.destroy
respond_to do |format|
format.html { redirect_to(@show) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n flash[:notice] = 'Ticket was successfully deleted.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @titlereceipt = Titlereceipt.find(params[:id])\n @titlereceipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(titlereceipts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend",
"def destroy\n @ticket_action = TicketAction.find(params[:id])\n @ticket_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_actions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @retailorderdetail = Retailorderdetail.find(params[:id])\n @retailorderdetail.destroy\n\n respond_to do |format|\n format.html { redirect_to(retailorderdetails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(receipts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @staff_rec = StaffRec.find(params[:id])\n @staff_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(staff_recs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket_type = TicketType.find(params[:id])\n @ticket_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticketorder = Ticketorder.find(params[:id])\n @ticketorder.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticketorders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket.destroy\n end",
"def destroy\n #@ticket = Ticket.find(params[:id])\n #@ticket.destroy\n\n #respond_to do |format|\n # format.html { redirect_to(tickets_url) }\n # format.xml { head :ok }\n #end\n\t\t\n\t\tredirect_to(tickets_url)\n end",
"def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(recursos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @certidao = Certidao.find(params[:id])\n @certidao.destroy\n\n respond_to do |format|\n format.html { redirect_to(certidaos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @quartz = Quartz.find(params[:id])\n @quartz.destroy\n\n respond_to do |format|\n format.html { redirect_to(quartzs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to(leases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @centru = Centru.find(params[:id])\n @centru.destroy\n\n respond_to do |format|\n format.html { redirect_to(centrus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @occurence = Occurence.find(params[:id])\n @occurence.destroy\n\n respond_to do |format|\n format.html { redirect_to(occurences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n\n respond_to do |format|\n format.html { redirect_to(tdocs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @envelope = Envelope.find(params[:id])\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to(envelopes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end",
"def destroy\n# @trip_report = TripReport.find(params[:id])\n# @trip_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_reports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @frequencia_setor = Frequencia::Setor.find(params[:id])\n @frequencia_setor.destroy\n\n respond_to do |format|\n format.html { redirect_to(frequencia_setores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invier_acceso = InvierAcceso.find(params[:id])\n @invier_acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(invier_accesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rede = Rede.find(params[:id])\n @rede.destroy\n\n respond_to do |format|\n format.html { redirect_to(redes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tcliente = Tcliente.find(params[:id])\n @tcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to(tclientes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_ticket\n @ticket = Ticket.find(params[:id])\n @ticket.delete\n \n render :nothing => true\n end",
"def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fax_document = FaxDocument.find(params[:id])\n @fax_document.destroy\n \n respond_to do |format|\n format.html { redirect_to(fax_documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inv_x_ref = InvXRef.find(params[:id])\n @inv_x_ref.destroy\n\n respond_to do |format|\n format.html { redirect_to inv_x_refs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kontak = Kontak.find(params[:id])\n @kontak.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontaks_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @travel_fix = TravelFix.find(params[:id])\n @travel_fix.destroy\n\n respond_to do |format|\n format.html { redirect_to(travel_fixes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoicehead = Invoicehead.find(params[:id])\n @invoicehead.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoiceheads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_obj2 = TestObj2.find(params[:id])\n @test_obj2.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_obj2s_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def destroy\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to(requisitions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recursorevision = @solicitud.recursosrevision.find(params[:id])\n @recursorevision.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitud_recursosrevision_url(@solicitud), :notice => \"Recurso de revisión eliminado con exito.\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @journal_line = JournalLine.find(params[:id])\n @journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @requisicion = Requisicion.find(params[:id])\n @requisicion.destroy\n\n respond_to do |format|\n format.html { redirect_to(requisicions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @requisicao = Requisicao.find(params[:id])\n @requisicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(requisicoes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n begin\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n rescue Exception => e\n #flash[:notice] = e.message\n flash[:notice] = msg_can_not_delete\n end \n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end \n end",
"def destroy\n @respuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @defect = Defect.find(params[:id])\n @defect.destroy\n\n respond_to do |format|\n format.html { redirect_to(defects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end",
"def destroy\n @trx_detail = TrxDetail.find(params[:id])\n @trx_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to trx_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailfetch = Mailfetch.find(params[:id])\n @mailfetch.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailfetches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @revenu = @foyer.revenus.find(params[:id])\n @revenu.destroy\n\n respond_to do |format|\n format.html { redirect_to foyer_revenus_url(@foyer) }\n format.xml { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n url = URI.parse('http://hes.zendesk.com/api/v2/tickets/' + self.id)\n http = Net::HTTP.new(url.host, url.port)\n auth = Base64.encode64(\"#{HesZendesk::AuthUser}:#{HesZendesk::AuthPwd}\")\n req = Net::HTTP::Delete.new(url.path, {\n 'Accept' => 'application/xml',\n 'Authorization' => \"Basic #{auth}\",\n 'Content-Type' => 'application/xml'\n })\n res = http.start { |h| h.request(req) }\n raise res.inspect\n case res\n when Net::HTTPSuccess\n location = res['location'].to_s\n puts location\n return t\n else\n return nil\n end\n end"
] | [
"0.69883704",
"0.6761964",
"0.6597504",
"0.6515955",
"0.6514402",
"0.6498467",
"0.6492914",
"0.6492914",
"0.6492914",
"0.6492914",
"0.6492914",
"0.6492914",
"0.6492914",
"0.64713323",
"0.64342463",
"0.64265966",
"0.6413221",
"0.64097005",
"0.64054596",
"0.63927865",
"0.6385412",
"0.6353927",
"0.6353804",
"0.6329565",
"0.6326582",
"0.63233924",
"0.6310738",
"0.6309078",
"0.6308785",
"0.63086206",
"0.63071066",
"0.63064057",
"0.6301838",
"0.63008785",
"0.62823975",
"0.6279306",
"0.6266048",
"0.6252282",
"0.62521535",
"0.62339944",
"0.62303966",
"0.6229551",
"0.6221762",
"0.6219488",
"0.6213445",
"0.6210654",
"0.6209324",
"0.6207612",
"0.6207189",
"0.6196041",
"0.6195638",
"0.6194537",
"0.61926526",
"0.6192449",
"0.6186212",
"0.61861557",
"0.61820114",
"0.61814624",
"0.61758953",
"0.61731404",
"0.61721313",
"0.61708325",
"0.61691964",
"0.61684936",
"0.61675495",
"0.61652833",
"0.6164516",
"0.6161623",
"0.6160019",
"0.6159224",
"0.61534",
"0.6152545",
"0.6151319",
"0.61504215",
"0.6145752",
"0.61442286",
"0.6143988",
"0.6143477",
"0.6142872",
"0.6139658",
"0.6138124",
"0.61379194",
"0.6134384",
"0.6134384",
"0.6134384",
"0.6127631",
"0.6127013",
"0.61253965",
"0.6122604",
"0.6121446",
"0.61180866",
"0.61175567",
"0.6117406",
"0.61168885",
"0.611298",
"0.61126924",
"0.611222",
"0.611222",
"0.61106217",
"0.61084586"
] | 0.6501533 | 5 |
A locale corresponds to a YAML file. We load each YAML file individually then merge then into a global hash. | def load_all_metas
Thread.current[:metas] = I18n.available_locales.inject({}) do |acc, locale|
acc.merge!(load_metas_for_locale(locale))
acc
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read\n result = {}\n \n Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|\n yml = YAML::load(IO.read(file))\n hash = @locale ? yml.to_hash[@locale] : yml.to_hash\n result.deep_merge! hash unless hash.nil?\n end\n\n result\n end",
"def load_files\n files = []\n translations = {}\n globals = {}\n I18n.load_path.each do |file|\n data = YAML.load_file(file)\n \n # Try to identify type from file's path name\n # TODO: Try to find a use for that\n case file\n when /\\/gems\\/activesupport-(.*)\\/lib\\/active_support\\/locale\\//:\n type = \"ActiveSupport\"\n when /\\/gems\\/activerecord-(.*)\\/lib\\/active_record\\/locale\\//:\n type = \"ActiveRecord\"\n when /\\/gems\\/actionpack-(.*)\\/lib\\/action_view\\/locale\\//:\n type = \"ActionView\"\n else\n type = \"file\"\n end\n\n if data.is_a? Hash\n # Skip non-hash translation files\n data.keys.collect do |locale|\n files << { :locale => locale, :filename => file, :type => type } \n locale = locale.to_sym\n # Mix in (from simpe I18n backend)\n translations[locale] ||= {}\n sdata = deep_symbolize_keys(data)\n merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }\n translations[locale].merge!(sdata[locale], &merger)\n # Build global translation keys from all locales\n globals.merge!(sdata[locale],&merger)\n end\n end\n \n end\n \n return {\n :files => files,\n :translations => translations,\n :globals => globals,\n }\n \n return files\n end",
"def load(filename)\n files= filename.include?(',') ? filename.split(',') : [filename]\n @yml = files.inject({}) do |total_merge,file|\n total_merge.merge!(::YAML.load(ERB.new(File.read(\"#{yml_directory}/#{file}\")).result(binding)))\n end\n end",
"def load_yml(filename)\n require 'yaml' unless defined? YAML\n data = YAML::load(IO.read(filename))\n data.each {|locale, d| merge_names(locale, d)}\n end",
"def update\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n\n @languages = {}\n files.each do |f|\n ar = YAML.load_file f\n lang = ar.keys.first\n if @languages.has_key?(lang.to_s)\n @languages[lang.to_s] = @languages[lang.to_s].deep_merge(ar.first[1])\n else\n @languages[lang.to_s] = ar.first[1]\n end\n end\n\n sync(@languages[I18n.default_locale.to_s])\n end",
"def load\n @yaml_parts, @ruby_parts = lookup_parts\n @data.clear\n self.yaml_parts_in_loading_order.each do |yaml_part|\n yaml_data = YAML.load_file(yaml_part)\n part_sections = File.basename(yaml_part, '.yml').split('.')\n part_sections.delete_at 0 # delete the 'en' at the beginning\n if part_sections.empty?\n @data.merge! yaml_data\n else\n begin\n target_section = @data[*part_sections]\n raise EntryNotFound unless target_section.respond_to? :merge!\n target_section.merge! yaml_data\n rescue EntryNotFound\n @data[*part_sections] = yaml_data\n end\n end\n end\n \n @ruby_parts.each do |ruby_part|\n Kernel.load ruby_part\n end\n end",
"def load_localization!\n reset_l10n_data\n\n # Load the rails localization\n if rails_localization_files\n rails_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n # if a country is defined\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n if locales.include?(\"#{lang}-#{country}\".to_sym)\n @@locales[\"#{lang}-#{country}\".to_sym].merge(YAML.load_file(file).symbolize_keys)\n else\n @@locales[\"#{lang}-#{country}\".to_sym] = YAML.load_file(file).symbolize_keys\n @@rails_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n @@languages << lang unless @@languages.include? lang\n else\n @@languages << lang unless @@languages.include? lang\n @f_locale = \"#{lang}-*\".to_sym\n @@locales[@f_locale] = @@locales[@f_locale].merge(YAML.load_file(file).symbolize_keys) if locales.include?(@f_locale)\n @@locales[@f_locale] = YAML.load_file(file).symbolize_keys unless locales.include?(@f_locale)\n end\n end\n end\n alias :load_translations! :load_localization!\n alias :load_localizations! :load_localization!\n\n # Load the UI localization\n if ui_localization_files\n ui_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n else\n country = '*'.to_sym\n end\n @@languages << lang unless @@languages.include? lang\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n @file_locale = \"#{lang}-#{country}\".to_sym\n if locales.include?(@file_locale)\n @@locales[@file_locale] = @@locales[@file_locale].merge(YAML.load_file(file).symbolize_keys)\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n else\n @@locales[@file_locale] = YAML.load_file(file).symbolize_keys\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n end\n end\n localize_rails\n # Return the path of the localization files\n return \"#{ui_localization_files} | #{rails_localization_files}\".to_s\n end",
"def dump\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n delete_all unless Interpret.soft\n\n records = []\n files.each do |f|\n ar = YAML.load_file f\n locale = ar.keys.first\n records += parse_hash(ar.first[1], locale)\n end\n\n # TODO: Replace with activerecord-import bulk inserts\n transaction do\n records.each {|x| x.save(:validate => false)}\n end\n end",
"def locale_translations\n @locale_scope ||= begin\n locale_path = \"#{@locale}.yml\"\n locale_path = File.join(@locales_dir, locale_path) if @locales_dir\n YAML.load_file(locale_path).fetch(@locale)\n end\n end",
"def load(*languages)\n languages.flatten!\n languages.each do |language|\n lang_file_without_ext = \"#{self.lang_file_dir}/#{language}\"\n @@cached_language_data[language.to_sym] = YAML.load_file \"#{lang_file_without_ext}.yml\"\n require lang_file_without_ext if File.exists?(\"#{lang_file_without_ext}.rb\")\n end\n self.use languages.first if current_language.nil?\n end",
"def load_yaml_files\n @room_list = YAML.load_file(__dir__ + '/rooms.yml')\n @weapon_list = YAML.load_file(__dir__ + '/weapons.yml')\n @enemy_list = YAML.load_file(__dir__ + '/enemy.yml')\n @high_score_list = YAML.load_file(__dir__ + '/high_score.yml')\n end",
"def import(file)\n hash = YAML.load file\n raise ArgumentError, \"the YAML file must contain an unique first key representing the locale\" unless hash.keys.count == 1\n\n lang = hash.keys.first\n\n unless lang.to_s == I18n.locale.to_s\n raise ArgumentError, \"the language doesn't match\"\n end\n\n records = parse_hash(hash.first[1], lang)\n transaction do\n records.each do |x|\n if tr = locale(lang).find_by_key(x.key)\n tr.value = x.value\n tr.save!\n else\n x.save!\n end\n end\n end\n end",
"def lookup_parts\n @yaml_parts = ActiveSupport::OrderedHash.new\n @ruby_parts = []\n \n self.lang_file_dirs.each do |lang_file_dir|\n yaml_parts_in_this_dir = Dir.glob(File.join(lang_file_dir, \"#{self.lang_code}*.yml\")).sort\n @yaml_parts[lang_file_dir] = yaml_parts_in_this_dir.collect {|part| File.basename(part)}\n ruby_part_in_this_dir = File.join(lang_file_dir, \"#{self.lang_code}.rb\")\n @ruby_parts << ruby_part_in_this_dir if File.exists?(ruby_part_in_this_dir)\n end\n \n [@yaml_parts, @ruby_parts]\n end",
"def merge_i18n(barclamp)\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if DEBUG\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\n end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def mappings_from_files\n mappings_paths.each_with_object({}) do |path, hash|\n file = \"#{path}.yml\"\n next unless File.exists?(file)\n load_yaml(file).each do |name, data|\n hash[name] = fix_mapping(name, data)\n end\n end\n end",
"def load_metas_for_locale(locale)\n path = metas_path(locale)\n if File.exists?(path)\n YAML.load(File.open(path))\n else\n logger.error \"[Metaslug] #{path} not found.\"\n {}\n end\n end",
"def load_collections\n notification_collection = {}\n collection_files.each do |file|\n notification_collection.merge!(YAML.load_file(file))\n end\n notification_collection.merge!(env_collection)\n end",
"def load_master_data\n #@master = load_yaml(DomainNeutral.master_locale, :master)\n @master = load_yaml(master_locale, :master)\n end",
"def load_translations( locale, base_locale=\"en\", type=\"all\", scope=\"\" )\n \n @files ||= load_files\n @languages = @files[:translations].keys.sort {|x,y| x.to_s <=> y.to_s }\n \n # Convert hash to scope string\n global = scopize( @files[:globals] )\n base = scopize( @files[:translations][base_locale.to_sym] )\n dest = scopize( @files[:translations][locale.to_sym] )\n translation = {}\n \n reg = Regexp.new( '^' + Regexp.escape( scope ))\n \n # Process all keys from all locales\n global.keys.each do |key| \n if((type == \"all\") or (type==\"untranslated\" and dest[key].nil?) or (type == \"translated\" and not ( dest[key].nil? )))\n if scope.empty? or key.match( reg )\n case base[key]\n when Hash\n value_type = \"hash\"\n when Array\n value_type = \"array\"\n when TrueClass, FalseClass\n value_type = \"bool\"\n else\n value_type = \"string\"\n end\n \n translation[key] = { \n :base => base[key].nil? ? \"Not translated in base [#{base_locale}]\" : base[key],\n :value => dest[key],\n :type => value_type,\n }\n end\n end\n end\n \n return translation\n end",
"def load_yml(filename); end",
"def load_locale!(locale)\n @projects.each do |project|\n @adapter.allowed_extensions.each do |extension|\n result = project.export locale, extension, @fallback\n\n if result.nil?\n raise \"Could not load project #{project} with extension #{extension} and locale #{locale}\"\n end\n\n strings, plurals = @adapter.parse result, extension\n\n strings = project.filter strings\n plurals = project.filter plurals\n\n warn \"Did not find any strings or plurals in #{project}\" if strings.empty? && plurals.empty?\n\n @strings[locale] = (@strings[locale] || {}).merge(strings)\n @plurals[locale] = (@plurals[locale] || {}).merge(plurals)\n end\n end\n end",
"def load\n config_files.each do |file|\n config = YAML::load(File.open(file))\n @config.merge! config\n end\n end",
"def combined_hash\n y = if @process_global\n normalize(global_yaml).rmerge(normalize(yaml))\n else\n normalize(yaml)\n end\n @process_local ? y.rmerge(normalize(local_yaml)) : y\n end",
"def merge_yaml_data(dir)\n data_output = {}\n file_sort_hierarchy(dir).each do |file|\n data = load_yaml(file)\n data_output.merge!(data) unless data.empty?\n end\n data_output.any? ? data_output : (raise StandardError, \"No key! please check the directory existence [#{dir}]\")\n end",
"def load_yaml(path) # Path must be in /data\n # path must be a yaml file path\n YAML.load_file(File.join(__dir__, \"../data/#{path}.yml\"))\n # YAML keys will be allways strings (never symbols)\n # Returns hash of values (strings)\nend",
"def load_yaml(filename); end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def yaml(*files, **options, &block) = read(*files, parse: :yaml, ext: ['.yml', '.yaml'], **options, &block)",
"def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end",
"def i18n\n %w(en es).each do |locale|\n copy_file \"i18n.#{ locale }.yml\", \"config/locales/seo_landing_pages.#{ locale }.yml\"\n end\n end",
"def load_regions\n YAML.load_file(\"#{root_path}/config/countries.yml\")\n end",
"def yaml_parts_in_loading_order\n ordered_yaml_parts = []\n @yaml_parts.each do |lang_file_dir, parts_in_this_dir|\n parts_in_this_dir.sort_by{|part| File.basename(part, '.yml').split('.').size}.each do |part|\n ordered_yaml_parts << File.join(lang_file_dir, part)\n end\n end\n ordered_yaml_parts\n end",
"def load_objects(dir_name, kind, klass)\n all_split_files_in(dir_name).map do |base_filename, (meta_ext, content_ext, locales)|\n I18n.locale = I18n.default_locale # Set current locale to default\n\n # Get filenames\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # is binary content?\n is_binary = !!(content_filename && [email protected][:text_extensions].include?(File.extname(content_filename)[1..-1]))\n\n # Read content and metadata\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # Is locale content?\n # - excluded content with locale meta IS a locale content\n # - excluded content without locale meta IS NOT locale content\n # - included content with or without locale meta IS locale content\n # - included content with locale meta set to `false` IS NOT locale\n # content\n is_locale = !!(meta['locale'] || (meta['locale'] != false && locale_content?(content_filename || meta_filename, kind)))\n\n # Create one item by locale, if content don't need a localized version,\n # use default locale\n (is_locale ? I18n.available_locales : [I18n.default_locale]).map do |locale|\n I18n.locale = locale # Set current locale\n\n # Process for localized files\n if is_locale\n # Get filenames for localized content\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # Read content and metadata for localized content\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # merge meta for current locale, default locale meta used by\n # default is meta don't have key\n meta_locale = meta.delete('locale') {|el| Hash.new }\n meta = (meta_locale[I18n.default_locale] || Hash.new).merge(meta)\n meta.merge!(meta_locale[locale.to_s] || Hash.new)\n end\n\n # Get attributes\n attributes = {\n :filename => content_filename,\n :content_filename => content_filename,\n :meta_filename => meta_filename,\n :extension => content_filename ? ext_of(content_filename)[1..-1] : nil,\n :locale => locale,\n # WARNING :file is deprecated; please create a File object manually\n # using the :content_filename or :meta_filename attributes.\n # TODO [in nanoc 4.0] remove me\n :file => content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil\n }.merge(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(dir_name.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(dir_name.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n # Prepend locale code to identifier if content is localized\n identifier = \"/#{locale}#{identifier}\" if is_locale\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(\n content_or_filename, attributes, identifier,\n :binary => is_binary, :mtime => mtime\n )\n end\n end.flatten # elements is an array with all locale item, flatten in to one items list\n end",
"def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end",
"def testlocale\n check_path = 'config/locales/'\n locale_list = %w(vi en ja)\n\n @missing_files = []\n @missing_keys = []\n # begin checking if all the necessary locale files exist\n folders = Dir.glob(\"#{check_path}**/*/\").push(check_path)\n for folder in folders do\n key_list = []\n for locale in locale_list do\n file = \"#{folder}#{locale}.yml\"\n if File.exist?(file)\n thing = YAML.load_file(file)\n key_list.push(flatten_keys(thing[locale]))\n else\n @missing_files.push(file)\n end\n end\n key_list.each_with_index do |key1,k1|\n for key2 in key_list do\n missing = key2 - key1\n if missing.any?\n missing.each { |key| @missing_keys.push(\"Missing #{key} in #{folder}#{locale_list[k1]}.yml\") }\n end\n\n end\n end\n end\n\n end",
"def run\n locales.each do |locale|\n # checking that all files / keys exist for any non.default locale\n self.files[locale].each do |file|\n build_hash(file)\n create_csv(file, locale)\n end\n end\n end",
"def generate_locale_files\n enforce = I18n.enforce_available_locales\n I18n.enforce_available_locales = false\n\n locales.each do |locale|\n I18n.with_locale(locale) do\n template 'locale.yml', File.join(\"config\", \"locales\", \"#{file_name}.#{locale.to_s}.yml\")\n end\n end\n\n I18n.enforce_available_locales = enforce\n end",
"def load!(file)\n hash = {}\n YAML.load_file(file).each do |k, v|\n hash[Pathname(k)] = v.map{|vv| Pathname(vv) }\n end\n replace(hash)\n end",
"def load_yaml_files(path)\n each_data_file(path).map { |file| YAML.load_file(file) }\n end",
"def load_i18n\n res = YAML.load_file(File.join(File.dirname(__FILE__), 'ie6nomore.i18n.yml'))\n end",
"def add(*files)\n # due to the multi passing of splat args, we can get Array-in-Array situations here\n files.flatten.each do |fn|\n @files.push(fn)\n if ! File.exists?(fn)\n next if self.class.skipmissing\n raise ArgumentError, \"file #{fn} does not exist\"\n end\n begin\n data = YAML.load(File.open(fn))\n if ! data.instance_of?(Hash)\n raise ArgumentError, \"file #{fn} does not contain a Hash\"\n end\n @cfg.deep_merge!(data.deep_symbolize_keys).deep_symbolize_keys\n rescue\n if ! self.class.skipbad\n raise\n end\n end\n end\n\n # resolve templates\n if self.class.templates\n resolve_templates\n end\n end",
"def export\n keys = {}\n reset\n db_localizations = {}\n Lit::Localization.find_each do |l|\n db_localizations[l.full_key] = l.get_value\n end\n db_localizations.sort.each do |(l_key, value)|\n current = keys\n yaml_keys = l_key.split('.')\n\n 0.upto(yaml_keys.size - 2) do |i|\n key = yaml_keys[i]\n # Overwrite en.key with en.sub.key\n unless current[key].class == Hash\n current[key] = {}\n end\n current = current[key]\n end\n current[yaml_keys.last] = value\n end\n keys.to_yaml\n end",
"def missing_localizations(org_base='en-US')\n @langs = {}\n @missing_localizations = {}\n @l_files = Dir[File.join( RAILS_ROOT, '/lang/ui', '*.yml')]\n @l_files.each do |file| \n if YAML.load_file(file)\n @langs[File.basename(file, '.*')] = YAML.load_file(file).symbolize_keys \n else\n p \"error with the following file: #{file}, the file might be empty\"\n end\n end\n @base_keys = @langs[org_base]\n unless @base_keys.blank?\n @langs.each_key do |@lang|\n @base_keys.each_key do |key|\n unless @langs[@lang].include?(key)\n @missing_localizations[@lang] ||= {}\n @missing_localizations[@lang] = @missing_localizations[@lang].merge({key.to_sym => @base_keys[key]})\n end\n end\n end\n else\n p \"your #{org_base} file seems empty\"\n end\n @missing_localizations\n end",
"def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end",
"def load_file( file, hash = {})\n fail 'given file is nil' unless file\n hash.merge!( YAML.load_file(file) )\n end",
"def load_config_files\n [\n Pathname.new(ENV['GUIGNOL_YML'] || '/var/nonexistent'),\n Pathname.new('guignol.yml'),\n Pathname.new('config/guignol.yml'),\n Pathname.new(ENV['HOME']).join('.guignol.yml')\n ].each do |pathname|\n next unless pathname.exist?\n return YAML.load(pathname.read)\n end\n return {}\n end",
"def merge_i18n(barclamp, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n locales = barclamp['locale_additions']\n locales.each do |key, value|\n #translation file (can be multiple)\n f = File.join CROWBAR_PATH, 'config', 'locales', \"#{key}.yml\"\n if File.exist? f\n puts \"merging translation for #{f}\" if debug\n master = YAML.load_file f\n master = merge_tree(key, value, master)\n File.open( f, 'w' ) do |out|\n YAML.dump( master, out )\n end\n else\n puts \"WARNING: Did not attempt tranlation merge for #{f} because file was not found.\"\n end\n end\nend",
"def load_library(path)\n data = YAML.load_file(path)\n # maps the data to their proper language despcriptions\n data.map do |key, value|\n data[key] = { english: value[0], japanese: value[1] }\n end\n data\nend",
"def load_translations(*filenames); end",
"def load_translations(*filenames); end",
"def load(*languages)\n languages.flatten!\n languages.each do |lang_code|\n lang_file = LangFile.new lang_code, self.lang_file_dirs\n @@languages[lang_code.to_sym] = lang_file\n lang_file.load\n end\n self.use languages.first if current_language.nil?\n end",
"def load_vms_dir(dirpath, vagrant_config)\n Dir.glob(dirpath) do |filepath|\n namespace = File.basename(filepath, \".*\") # stackfilename\n vms_file = load_yaml(filepath)\n vms_file.each do |key, value| \n vm_config = value\n vm_config['lib'] = vm_config['lib'] || {}\n vm_config['lib']['namespace'] = namespace\n vm_config['lib']['key'] = \"#{key}\"\n vm_hash_id = \"#{vm_config['lib']['key']}.#{vm_config['lib']['namespace']}\"\n # puts \"resolving #{vm_hash_id}\"\n unless value['definition'].to_s.empty?\n if $definitions[value['definition']]\n # puts \"#{vm_hash_id} has #{value['definition']}\"\n definition = $definitions[value['definition']]\n vm_config = definition.deep_merge(vm_config)\n end\n end\n if $vms[vm_hash_id]\n # puts \"merging #{vm_hash_id}\"\n vm_config = $vms[vm_hash_id].deep_merge(vm_config)\n else\n # puts \"not merging #{vm_hash_id}\"\n end\n if $user\n vm_config = $user.deep_merge(vm_config)\n end\n $vms[vm_hash_id] = vm_config\n end\n end\nend",
"def generate_yaml(locale_name, translations)\n yaml = YamlDocument.new(\"config/locales/translation_#{locale_name}.yml\", locale_name)\n each_value [], translations do |parents, value|\n node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}\n node.value = value\n end\n yaml\n end",
"def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $stderr.puts 'No valid translation file given'\n []\n end\n update_store files\n end",
"def load(clear=true, filename = @filename)\n @mutex.synchronize{\n @filename = filename\n\n hash = YAML.load_file( filename )\n self.clear if clear\n self.merge!(hash)\n }\n end",
"def load_library(file_path)\n emoticons_hash = YAML.load_file(file_path)\n emoticons_hash.each_with_object({}){|(outer_key,outer_value), new_hash|\n new_hash[outer_key] = {english: outer_value[0], japanese: outer_value[1]}\n }\nend",
"def load_from_dir dir\n Dir[File.join(dir,\"*.yml\")].each do |file|\n begin\n var_name = File.basename(file).gsub(/s\\.yml/,'')\n my_count = 0\n File.open(file) do |my_file|\n last_obj = nil\n while line = my_file.gets do\n if line == \"--- \\n\" #uj yaml objekt :)\n if last_obj\n o = YAML.load(last_obj) \n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n last_obj = ''\n end\n last_obj = last_obj + line\n end\n o = YAML.load(last_obj)\n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n\n try(\"puts \\\"Cache loaded @#{var_name}: #{my_count} instances from disk.\\\"\")\n rescue Exception => e\n puts \"Can not load #{file}.\"\n puts e.message\n end\n end\n end",
"def load_from_dir dir\n Dir[File.join(dir,\"*.yml\")].each do |file|\n begin\n var_name = File.basename(file).gsub(/s\\.yml/,'')\n my_count = 0\n File.open(file) do |my_file|\n last_obj = nil\n while line = my_file.gets do\n if line == \"--- \\n\" #uj yaml objekt :)\n if last_obj\n o = YAML.load(last_obj) \n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n last_obj = ''\n end\n last_obj = last_obj + line\n end\n o = YAML.load(last_obj)\n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n\n try(\"puts \\\"Cache loaded @#{var_name}: #{my_count} instances from disk.\\\"\")\n rescue Exception => e\n puts \"Can not load #{file}.\"\n puts e.message\n end\n end\n end",
"def load_library(file)\n emoticon = YAML.load_file('./lib/emoticons.yml')\ncontainer = {}\n emoticon.each do |meaning,emoticon|\n container[meaning] = {}\n container[meaning][:english] = emoticon[0]\n container[meaning][:japanese] = emoticon[1]\n end\n container\nend",
"def load\n yaml = YAML.load_file(@file_path)\n yaml.each {|k, v| interpolate_setting(yaml, v)}\n settings = OpenStruct.new\n add_hash(settings, yaml)\n\n @lock.synchronize do\n @yaml = yaml\n @settings = settings\n end\n rescue\n puts \"Failed to load file: #{@file_path}\\n#{$!}\"\n end",
"def load(path, env)\n yaml_safe_load(File.open(path).read)[env].each do |section, settings|\n section = instance_variable_get(\"@#{section}\")\n next unless section\n settings.each do |setting, value|\n unless section == @index || section == @source\n value = interpolate_string(value, nil)\n end\n setter(section, setting, value)\n end\n end\n end",
"def import\n read_dict_file(:langA)\n write_database(:langA)\n\n read_dict_file(:langB)\n write_database(:langB)\n end",
"def mappings_from_dirs\n mappings_paths.map { |path| Dir[\"#{path}/*.yml\"] }.\n flatten.sort.\n each_with_object({}) do |file, hash|\n name = File.basename file, '.yml'\n hash[name] = fix_mapping(name, load_yaml(file))\n end\n end",
"def load_library(file_path)\n loadme = YAML.load_file(file_path)\n translatorhash = {get_meaning: {}, get_emoticon: {}}\n loadme.each_key do |k|\n translatorhash[:get_meaning][loadme[k][1]] = k\n end\n loadme.each_key do |k|\n translatorhash[:get_emoticon][loadme[k][0]] = loadme[k][1]\n end\n translatorhash\nend",
"def load_settings\n attributes = YAML.load_file(\"defaults.yml\")\n begin\n custom_attributes = YAML.load_file(\"config.yml\")\n attributes = simple_deep_merge(attributes, custom_attributes)\n rescue\n end\n attributes\nend",
"def load_yaml_data( file )\n yaml_data = {}\n yaml_data.merge!( File.open( file ) { |yf| YAML::load( yf ) } )\n\n return yaml_data\n end",
"def all_locales\n locales = []\n Rails.root.glob(\"config/locales/*.yml\").each do |file|\n match = /(\\w+).yml$/.match(file.to_s)\n locales << match[1] if match\n end\n locales\nend",
"def load_library(file_path)\n # code goes here\n #library is a hash of array\n #the task here is to convert the array to a hash with two key value pairs\n library = YAML.load_file(file_path)\n new_library={}\n #access in to the array\n library.each{|english_name, emoticons|\n new_library[english_name] = {}\n new_library[english_name][:english] = emoticons[0] \n new_library[english_name][:japanese] = emoticons[1] \n}\nnew_library\nend",
"def load_library(file_path)\n library = YAML.load_file('./lib/emoticons.yml')\n result = {}\n library.each do |meaning, emoticons|\n result[meaning] = {}\n english = emoticons[0]\n japanese = emoticons[1]\n result[meaning][:english] = english\n result[meaning][:japanese] = japanese\n end\n result\nend",
"def plural_hashload(filenames, parsers)\n #load and parse files\n result = filenames.inject({}) { |result,filename|\n result.merge!( hashload(filename,parsers) ) }\n # Replace nil with empty string\n hash = Hash[result.map { |k,v| [k, v == nil ? \"\" : v] }]\n return hash\n end",
"def for(host, files = expandable_default_files)\n translate(files.inject({}) { |settings, file|\n load(file, host, settings)\n })\n end",
"def load_yaml(file, default={})\n default.merge(YAML.load_file(file))\n end",
"def get_locales\n fall_back = [:ru].to_yaml\n locales = CustomSetting.find_or_create_by_name(\"languages\").value || fall_back\n begin\n locales = YAML::load(locales)\n rescue\n locales = YAML::load(fall_back)\n end\n end",
"def load_definitions(dirpath)\n Dir.glob(dirpath) do |item|\n namespace = File.basename(item, \".*\")\n definitions = load_yaml(item)\n definitions.each do |key, value|\n definition_key = \"#{key}.#{namespace}\"\n if $definitions[definition_key]\n $definitions[definition_key] = $definitions[definition_key].deep_merge(value)\n else\n $definitions[definition_key] = value\n end\n end\n end\n log_to_file(\"_definitions.yaml\", $definitions.sort_by_key(true).to_h.to_yaml)\nend",
"def load_all_entries\n results = self.all :order=>\"locale, key\"\n data = {}\n\n results.each do |result|\n #create an empty hash for each locale initially\n data[result.locale] ||= {}\n\n # create the deep nested scopes from the dotted key\n scopes = result.key.split(\".\").map{|k| k.to_sym}\n key = scopes.pop\n scope = scopes.inject(data[result.locale]) do |scope, s|\n # a new scope is empty initially\n # if its a simple string override it with a empty hash\n scope[s] = {} unless scope[s] and scope[s].is_a?(Hash)\n scope[s]\n end\n\n # if we have a pluralization form and the translation key already exists add the specific pluralization form\n if scope[key] && scope[key].is_a?(Hash) && !result.pluralization_index.blank?\n scope[key][result.pluralization_index] = result.text\n\n # if we have a pluralization index add the initial hash\n elsif !result.pluralization_index.blank?\n scope[key] = { result.pluralization_index.to_sym => result.text.to_s }\n\n # else we just add the simple text\n else\n scope[key] = result.text\n end\n\n end\n return data\n end",
"def yaml_parts_in_saving_order\n lang_file_dirs_by_parts = ActiveSupport::OrderedHash.new\n @yaml_parts.each do |lang_file_dir, parts_in_this_dir|\n parts_in_this_dir.each do |part|\n lang_file_dirs_by_parts[part] = (lang_file_dirs_by_parts[part] || []) << lang_file_dir\n end\n end\n \n ordered_yaml_parts = []\n lang_file_dirs_by_parts.keys.sort_by{|key| key.split('.').size}.reverse.each do |part|\n lang_file_dirs_by_parts[part].reverse.each do |lang_file_dir|\n ordered_yaml_parts << File.join(lang_file_dir, part)\n end\n end\n \n ordered_yaml_parts\n end",
"def load_yaml(filename)\n\t\tpath = File.realpath(filename)\n\t\tdata = YAML.load_file(path)\n\t\tload_hash(data)\n\tend",
"def rails_localization_files\n loc_files = Dir[File.join( RAILS_ROOT, '/vendor/plugins/globalite/lang/rails/', '*.{yml,yaml}')]\n end",
"def data\n YAML::load_file(files[:config])\n end",
"def load(file_path, local_variables = {})\n yaml = render file_path, local_variables\n YAML.load yaml\n end",
"def initialize(language = :default, replacement = \"?\")\n \n if Symbol === language\n path = \"#{File.dirname(__FILE__)}/mappings/#{language}.yaml\"\n else\n path = language\n end\n \n h = YAML.load_file(path)\n i = Iconv.new(\"UCS-4\",\"UTF-8\")\n \n # use the default replacement if the hash \n @map = Hash.new( i.iconv(replacement).unpack(PackFormat) )\n \n # the mappings file is UTF-8, recode to UCS-4\n h.each { |k,v|\n @map[*i.iconv(k).unpack(PackFormat)] = i.iconv(v).unpack(PackFormat)\n }\n \n @map\n end",
"def load_yml_data\n if File.exist? self.class.file_location\n # YAML.load_file returns false if the file exists but is empty. So\n # added the || {} to ensure we always return a hash from this method\n YAML.load_file(self.class.file_location) || {}\n else\n {}\n end\n end",
"def yaml_files\n file_list('{,puppet/}{,hiera}data/**/*.{yaml,eyaml}') +\n file_list('config/**/*.yml')\n end",
"def load_file(file)\n buf = File.read(file)\n\n # parse the document into a Psych tree; we don't load here because we want\n # the file/line info while creating our entities.\n doc = YAML.parse(buf, filename: file)\n\n # Document should be an Array of Hashes\n seq = doc.children.first or return # ignore empty documents\n load_error!('not a yaml sequence (Array)', file, seq) unless seq.sequence?\n\n # Loop through each Hash\n seq.children.each do |map|\n\n # Make sure it's a mapping before we convert it to a ruby Hash\n load_error!('not a yaml mapping (Hash)', file, map) unless map.mapping?\n entity = YAML.send(:symbolize_names!, map.to_ruby)\n\n # Ensure they're not using some unknown keys\n unknown_keys = entity.keys - SUPPORTED_KEYS\n load_error!(\"unknown keys: #{unknown_keys}\", file, map) unless\n unknown_keys.empty?\n\n load_error!(\"id and update are mutually exclusive\", file, map) if\n entity[:id] and entity[:update]\n\n source = \"#{file}:#{map.start_line + 1}\"\n\n create = {}\n create[:id] = entity[:id] if entity.has_key?(:id)\n create[:update] = entity[:update] if entity.has_key?(:update)\n\n # Create an Array of the various base Entities that will be layered into\n # this Entity\n create[:base] = [entity[:base]].flatten.compact\n\n # Construct an Array of component arguments that will be sent to\n # Morrow::EntityManager#create_entity\n entity[:components] ||= []\n load_error!('The `components` field must be an Array; %s' %\n [ entity[:components].inspect ], file, map) unless\n entity[:components].is_a?(Array)\n\n create[:components] = entity[:components].map do |conf|\n case conf\n when Symbol\n conf\n when String\n conf.to_sym\n when Hash\n load_error!(<<~ERROR, file, map) unless conf.size == 1\n Multiple keys found in single component configuration. Note that\n the `components` field is an Array. Perhaps you missed a '-'\n before the next component after this one.\n ERROR\n\n # A Hash is a component with non-default values. The values may be\n # provided as a Hash, an Array (must have all elements), or a scalar\n # (for single field Components)\n comp, config = conf.first\n case config\n when Hash\n config.rekey! { |k| k.to_sym }\n when Array\n # don't make any changes\n else\n # turn this non-array value into an array of a single element\n config = [ config ]\n end\n { comp.to_sym => config }\n else\n load_error!('Unsupported component configuration type: %s' %\n [ conf.inspect ], file, map)\n end\n end\n\n create[:remove] = entity[:remove] || []\n\n # defer the action if we're not able to do it at the moment\n begin\n create_or_update(**create)\n rescue Morrow::UnknownEntity\n defer(source: source, entity: create)\n rescue Exception => ex\n raise Morrow::Error, <<~ERROR.chomp\n error in entity file: #{source}: #{entity.pretty_inspect\n .chomp.gsub(/\\n/, \"\\n\" + ' ' * 16)}\n ERROR\n end\n end\n\n # Attempt to flush any deferred actions now that we've loaded everything in\n # the file.\n flush\n end",
"def import!(file)\n if File.directory?(file)\n # ...\n else\n case File.extname(file)\n when '.yaml', '.yml'\n merge!(YAML.load(File.new(file)))\n else\n text = File.read(file)\n if /\\A---/ =~ text\n name = File.basename(file)\n self[name] = YAML.load(text)\n else\n name = File.basename(file)\n self[name] = text.strip\n end\n end\n end\n end",
"def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end",
"def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end",
"def update_translation( key, value, locale )\n \n # lock file\n filename = File::join RAILS_ROOT, \"config/locales\", File::basename( locale + \".yml\" )\n if( File.exists? filename )\n file = File.new( filename, \"r+\")\n else\n file = File.new( filename, \"w+\" ) \n end\n \n file.flock( File::LOCK_EX )\n \n begin \n # read project locale file\n data = YAML.load( file )\n unless data.is_a? Hash \n I18n.load_path << filename\n data = { locale => {} } unless data \n end\n \n tmp = data\n \n # create middle hash keys as needed\n key = locale + \".\" + key\n keys = key.split(/\\./)\n base_key = keys.pop\n \n while tmpkey = keys.shift\n unless tmp[tmpkey].class == Hash\n tmp[tmpkey] = {}\n end\n tmp = tmp[tmpkey]\n end\n \n # update or create value\n tmp[base_key] = value\n \n # save file\n file.truncate( 0 )\n file.rewind\n file.write( data.to_yaml )\n ensure\n # unlock and close file\n file.flock( File::LOCK_UN )\n file.close\n end\n \n I18n.reload!\n \n end",
"def load_library(path)\n #set a hash with get_meaning, get_emoticon as keys, empty hash for value\n emoticons = {\"get_meaning\" => {}, \"get_emoticon\" => {}}\n #load the YAML file. It has meaning(angel, angry,..) as key and the symbol as value(describe)\n YAML.load_file(path).each do |meaning, describe|\n #set eng, jan from describe, so eng would be the first value, jan the second\n eng, jan = describe\n emoticons[\"get_meaning\"][jan] = meaning\n emoticons[\"get_emoticon\"][eng] = jan\n\n end\n emoticons\nend",
"def local_yaml\n parse_yaml_string(yaml_string(local_config_file), local_config_file)\n end",
"def create_locale_files\n @i18n_scope = model.i18n_scope.to_s\n @i18n_key = model.model_name.i18n_key.to_s\n @columns = model.column_names\n\n options[:locales].each do |locale|\n @locale = locale\n locale_file = File.join(\n 'config/locales/models', model_name.underscore, \"#{@locale}.yml\"\n )\n template 'locale.yml', locale_file\n end\n rescue NameError\n puts \"#{model_name} is undefined.\"\n end",
"def load_yaml(file, env_vars, my = nil)\n\n yaml = YAML.load_file(file)\n eval_map_values(yaml, env_vars, file, my || yaml)\n end",
"def load_translations_and_collect_file_errors(files); end",
"def write_to_file keys\n init_translations_and_ignore_app_mode_file_dump if self.class.mode == :origin\n # Hash to capture the files updated on origin mode and the keys for each one\n result = {}\n keys.each do |key, value|\n #\n # Search the files where the translation will be applied to\n decide_filenames(key).each do |filename| \n (result[filename] ||= []) << key\n # Apply the current translation to the filenames\n #\n # It will save a key 'ubiquo.categories.index.title' with a value 'Title'\n # mergin the content of $filename with it\n #\n # Load the file\n hash = YAML.load_file(filename)\n # Morph the translation key\n # from: 'ubiquo.categories.index.title'\n # to: { :ubiquo => {\n # :categories => {\n # :index => {\n # :title => 'Title'\n # }\n # }\n # }\n # }\n # }\n branch_hash = Translate::Keys.to_deep_hash({key => value})\n #\n # Cast all the hash keys to String\n #\n branch_hash = Translate::File.deep_stringify_keys({self.locale => branch_hash})\n #\n # Merge the translation with the content of the file\n #\n #\n hash.deep_merge!(branch_hash)\n #\n # Save to file updated to disk\n Translate::File.new(filename).write(hash)\n end \n end\n result\n end",
"def load_library(file_path)\n # code goes here\n new_hash = {\n \"get_meaning\" => {},\n \"get_emoticon\" => {}\n }\n emo_hash = YAML.load_file(file_path)\n emo_hash.each do |meaning, emoticons|\n new_hash[\"get_meaning\"][emoticons[1]] = meaning\n new_hash[\"get_emoticon\"][emoticons[0]] = emoticons[1]\n end\n new_hash\nend",
"def init_translations_and_ignore_app_mode_file_dump\n # Get the current yaml file list sorted\n files = (I18n.load_path + Dir.glob(File.join(\"config\", \"locales\", \"**\",\"*.{rb,yml}\"))).uniq.sort\n # Avoid application mode file paths\n files -= I18n.available_locales.map{|l| application_mode_file_path(l)}\n files -= I18n.available_locales.map{|l| File.join(\"config\", \"locales\", \"#{l}.yml\")}\n # Load the new translation file list\n I18n.load_path = files\n # Reset I18n to track the updated file list\n I18n.reload!\n I18n.backend.send(:init_translations)\n end",
"def ui_localization_files\n loc_files = Dir[File.join(RAILS_ROOT, 'lang/ui/', '*.{yml,yaml}')]\n unless @@localization_sources.empty?\n @@localization_sources.each do |path|\n loc_files += Dir[File.join(path, '*.{yml,yaml}')]\n end\n end\n loc_files\n end",
"def languages\n grouped_language_files.map do |language, stats|\n additions = summarize(stats, :additions)\n deletions = summarize(stats, :deletions)\n net = summarize(stats, :net)\n LanguageSummary.new(language, additions, deletions, net, added_files, deleted_files, modified_files)\n end\n end",
"def get_files\n self.locales.each do |l|\n self.files[l] = Dir.glob(\"#{self.locale_dir}/*#{l}.#{self.source_format}\")\n\n next if l == self.default_locale\n\n self.files[self.default_locale].each do |original_file|\n locale_file = original_file.gsub(\"#{self.default_locale}.#{self.source_format}\", \"#{l}.#{self.source_format}\")\n\n next if self.files[l].include?(locale_file)\n\n create_locale_file(locale_file, original_file)\n\n self.files[l] << locale_file\n end\n end\n end"
] | [
"0.76829284",
"0.706411",
"0.7061746",
"0.7052909",
"0.6974177",
"0.68951815",
"0.6659456",
"0.6575945",
"0.65721893",
"0.65327257",
"0.64131576",
"0.6361158",
"0.63542837",
"0.6340097",
"0.6311979",
"0.62705505",
"0.62437814",
"0.61771476",
"0.61595815",
"0.6146397",
"0.6145141",
"0.6114269",
"0.6078765",
"0.6057813",
"0.6055583",
"0.60511386",
"0.6050009",
"0.6042813",
"0.6035145",
"0.60200095",
"0.601724",
"0.6001383",
"0.5998806",
"0.5987107",
"0.5985942",
"0.59843427",
"0.598015",
"0.59736264",
"0.59541976",
"0.59077895",
"0.5897019",
"0.58969575",
"0.5869875",
"0.5867284",
"0.58572966",
"0.5855262",
"0.5845903",
"0.58346295",
"0.5831843",
"0.5805658",
"0.5805658",
"0.57788247",
"0.57783365",
"0.5774651",
"0.57673454",
"0.57636976",
"0.57621115",
"0.5744723",
"0.5744723",
"0.5730998",
"0.57265055",
"0.57225716",
"0.572011",
"0.57150495",
"0.57114315",
"0.57092345",
"0.56926435",
"0.5692238",
"0.5687996",
"0.56667566",
"0.56627095",
"0.56548905",
"0.56509626",
"0.56346947",
"0.56315225",
"0.562204",
"0.5611692",
"0.5611211",
"0.5601368",
"0.56001186",
"0.55973047",
"0.5590945",
"0.55904895",
"0.5585524",
"0.55642194",
"0.5564166",
"0.55623466",
"0.55623466",
"0.5560977",
"0.55591625",
"0.55567557",
"0.5544127",
"0.554128",
"0.5531522",
"0.55167407",
"0.551441",
"0.55098236",
"0.55061865",
"0.54992443",
"0.5495315"
] | 0.5905777 | 40 |
Load a YAML file corresponding to a locale after ensuring it exists. | def load_metas_for_locale(locale)
path = metas_path(locale)
if File.exists?(path)
YAML.load(File.open(path))
else
logger.error "[Metaslug] #{path} not found."
{}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yml(filename); end",
"def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end",
"def load_yaml(filename); end",
"def load_yml(filename)\n require 'yaml' unless defined? YAML\n data = YAML::load(IO.read(filename))\n data.each {|locale, d| merge_names(locale, d)}\n end",
"def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end",
"def load_yaml(path)\n YAML.load_file File.expand_path(\"../#{path}\", File.dirname(__FILE__))\n end",
"def load_yaml(args = {})\n file = File.read(args[:file] || CMUX_YAML)\n yaml = YAML.load(file)\n args[:key] ? yaml[args[:key]] : yaml\n rescue Psych::SyntaxError\n message = \"Make sure you've written #{file} in YAML Simple Mapping.\" \\\n ' Please check README.'\n raise message.red\n end",
"def load_yaml_file(path)\n if (file = find_data_file(path))\n YAML.load_file(file)\n end\n end",
"def yaml_load filename\n yaml_string = File.read filename\n\n YAML::load yaml_string\nend",
"def yaml_load filename\n yaml_string = File.read filename\n\n YAML::load yaml_string\nend",
"def load(filename, dontValidateDirs = false)\n rc = true\n if File.exists?(filename)\n File.open(filename){ |fh|\n yaml = YAML::load(fh)\n return handleYaml(yaml, dontValidateDirs)\n }\n else\n $logger.info \"Loading config file failed: file '#{filename}' doesn't exist.\"\n end\n rc\n end",
"def loadyaml(filename) YAML.load_file(filename) end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def import(file)\n hash = YAML.load file\n raise ArgumentError, \"the YAML file must contain an unique first key representing the locale\" unless hash.keys.count == 1\n\n lang = hash.keys.first\n\n unless lang.to_s == I18n.locale.to_s\n raise ArgumentError, \"the language doesn't match\"\n end\n\n records = parse_hash(hash.first[1], lang)\n transaction do\n records.each do |x|\n if tr = locale(lang).find_by_key(x.key)\n tr.value = x.value\n tr.save!\n else\n x.save!\n end\n end\n end\n end",
"def load_translations\n files = if File.directory?(@path)\n Dir[@path + '/**/*.yml']\n elsif File.file?(@path)\n detect_list_or_file @path\n else\n $stderr.puts 'No valid translation file given'\n []\n end\n update_store files\n end",
"def remove_locale_file language\n File.delete yml_path(language) if File.exists?(yml_path language)\n\n new_load_paths = I18n.load_path.map do |path|\n path unless path.include?(\"#{language}.yml\")\n end.compact\n\n I18n.load_path = new_load_paths\n\n I18n.locale = I18n.default_locale\nend",
"def load_yaml(path, environment = nil)\n env = environment ? environment.to_s : env_name\n\n contents = File.read(path)\n if contents.empty?\n raise Mongoid::Errors::EmptyConfigFile.new(path)\n end\n\n # These are the classes that can be used in a Mongoid\n # configuration file in addition to standard YAML types.\n permitted_classes = [\n # Symbols occur as values for read preference, for example.\n Symbol,\n # BSON::Binary occur as keyId values for FLE (more precisely,\n # the keyIds are UUIDs).\n BSON::Binary,\n ]\n\n result = ERB.new(contents).result\n data = if RUBY_VERSION < '2.6'\n YAML.safe_load(result, permitted_classes, [], true)\n else\n YAML.safe_load(result, permitted_classes: permitted_classes, aliases: true)\n end\n\n unless data.is_a?(Hash)\n raise Mongoid::Errors::InvalidConfigFile.new(path)\n end\n\n data[env]\n end",
"def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end",
"def load\n @yaml_parts, @ruby_parts = lookup_parts\n @data.clear\n self.yaml_parts_in_loading_order.each do |yaml_part|\n yaml_data = YAML.load_file(yaml_part)\n part_sections = File.basename(yaml_part, '.yml').split('.')\n part_sections.delete_at 0 # delete the 'en' at the beginning\n if part_sections.empty?\n @data.merge! yaml_data\n else\n begin\n target_section = @data[*part_sections]\n raise EntryNotFound unless target_section.respond_to? :merge!\n target_section.merge! yaml_data\n rescue EntryNotFound\n @data[*part_sections] = yaml_data\n end\n end\n end\n \n @ruby_parts.each do |ruby_part|\n Kernel.load ruby_part\n end\n end",
"def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::ENOENT\n return\n end",
"def locale_file_path(locale)\n \"config/locales/#{locale}.yml\"\n end",
"def assert_generated_yaml(path)\n assert_generated_file(\"#{path}.yml\") do |body|\n yaml = RailsLts::Support::YAML.legacy_load(body)\n assert yaml, 'YAML data missing'\n yield yaml if block_given?\n end\n end",
"def load(name)\n yml_file(\"#{name}/#{environment}\") ||\n yml_file_with_key(\"#{name}\", environment) ||\n yml_file(\"#{name}/default\") ||\n yml_file_with_key(\"#{name}\", 'default') ||\n raise(NotFound.new(name, environment))\n end",
"def load_dictionary(lang)\n return false unless lang\n dictionary = File.join(File.dirname(__FILE__), 'dictionaries', \"#{lang}.yml\")\n YAML::load(File.open(dictionary))\n end",
"def load_yml\n cfg_file=\"#{::Rails.root}/config/mcommunity.yml\"\n\n begin\n mcommunity_erb = ERB.new(IO.read(cfg_file)).result(binding)\n rescue StandardError, SyntaxError => e\n raise(\"#{cfg_file} could not be parsed with ERB. \\n#{e.inspect}\")\n end\n\n begin\n mcommunity_yml = YAML::load(mcommunity_erb)\n rescue => e\n raise(\"#{cfg_file} was found, but could not be parsed.\\n#{e.inspect}\")\n end\n\n if mcommunity_yml.nil? || !mcommunity_yml.is_a?(Hash)\n raise(\"#{cfg_file} was found, but was blank or malformed.\\n\")\n end\n\n begin\n raise \"The #{::Rails.env} environment settings were not found in #{cfg_file}\" unless mcommunity_yml[::Rails.env]\n mcommunity_cfg = mcommunity_yml[::Rails.env].symbolize_keys\n end\n\n mcommunity_cfg\nend",
"def load(filename)\n update! YAML.load_file(filename)\n end",
"def yaml_load(filename)\n\t\tbegin\n\t\t YAML::load(File.read filename)\n\t\trescue\n\t\t\tputs \"Unable to read from file '#{ filename }'.\"\n\t\t\tnil\n\t\tend\n\tend",
"def yaml\n @yaml ||= YAML.load_file path\n rescue StandardError\n {}\n end",
"def load(filename)\n files= filename.include?(',') ? filename.split(',') : [filename]\n @yml = files.inject({}) do |total_merge,file|\n total_merge.merge!(::YAML.load(ERB.new(File.read(\"#{yml_directory}/#{file}\")).result(binding)))\n end\n end",
"def read_yaml_file(file)\n if File.exist?(file)\n return YAML::load(File.read(file))\n end\n raise \"-- ERROR: file doesn't exist: \" + file\n end",
"def load_yaml(path) # Path must be in /data\n # path must be a yaml file path\n YAML.load_file(File.join(__dir__, \"../data/#{path}.yml\"))\n # YAML keys will be allways strings (never symbols)\n # Returns hash of values (strings)\nend",
"def load(args)\n YAML::load_file(args[:file_name])\n end",
"def load_localization!\n reset_l10n_data\n\n # Load the rails localization\n if rails_localization_files\n rails_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n # if a country is defined\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n if locales.include?(\"#{lang}-#{country}\".to_sym)\n @@locales[\"#{lang}-#{country}\".to_sym].merge(YAML.load_file(file).symbolize_keys)\n else\n @@locales[\"#{lang}-#{country}\".to_sym] = YAML.load_file(file).symbolize_keys\n @@rails_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n @@languages << lang unless @@languages.include? lang\n else\n @@languages << lang unless @@languages.include? lang\n @f_locale = \"#{lang}-*\".to_sym\n @@locales[@f_locale] = @@locales[@f_locale].merge(YAML.load_file(file).symbolize_keys) if locales.include?(@f_locale)\n @@locales[@f_locale] = YAML.load_file(file).symbolize_keys unless locales.include?(@f_locale)\n end\n end\n end\n alias :load_translations! :load_localization!\n alias :load_localizations! :load_localization!\n\n # Load the UI localization\n if ui_localization_files\n ui_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n else\n country = '*'.to_sym\n end\n @@languages << lang unless @@languages.include? lang\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n @file_locale = \"#{lang}-#{country}\".to_sym\n if locales.include?(@file_locale)\n @@locales[@file_locale] = @@locales[@file_locale].merge(YAML.load_file(file).symbolize_keys)\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n else\n @@locales[@file_locale] = YAML.load_file(file).symbolize_keys\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n end\n end\n localize_rails\n # Return the path of the localization files\n return \"#{ui_localization_files} | #{rails_localization_files}\".to_s\n end",
"def load_yml(template, options={})\n case File.extname(template)\n when '.erb'\n parse_erb(template, options)\n else\n YAML.load_file(template)\n end\n end",
"def load(*languages)\n languages.flatten!\n languages.each do |language|\n lang_file_without_ext = \"#{self.lang_file_dir}/#{language}\"\n @@cached_language_data[language.to_sym] = YAML.load_file \"#{lang_file_without_ext}.yml\"\n require lang_file_without_ext if File.exists?(\"#{lang_file_without_ext}.rb\")\n end\n self.use languages.first if current_language.nil?\n end",
"def load_i18n\n res = YAML.load_file(File.join(File.dirname(__FILE__), 'ie6nomore.i18n.yml'))\n end",
"def load_config\n create_yolo_dir\n unless File.exist?(yaml_path)\n @formatter.config_created(yaml_path)\n FileUtils.cp_r(File.dirname(__FILE__) + \"/config.yml\", yaml_path)\n end\n end",
"def load_remote_yml(environment, path)\r\n yml = \"config/database.#{environment}-#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.yml\"\r\n begin\r\n get path, yml\r\n config = YAML::load_file(yml)\r\n return config[environment.to_s]\r\n rescue\r\n raise\r\n ensure\r\n `rm -f #{yml}`\r\n end\r\nend",
"def load_regions\n YAML.load_file(\"#{root_path}/config/countries.yml\")\n end",
"def load_yaml_file file\r\n load_yaml \"parse_file\", file\r\n end",
"def load_yaml(filename)\n\t\tpath = File.realpath(filename)\n\t\tdata = YAML.load_file(path)\n\t\tload_hash(data)\n\tend",
"def read_file(path)\r\n YAML::load( File.open(path) )\r\n end",
"def reset_locale language\n if language.nil? or language.empty?\n return\n end\n create_base_yml_file_without_missions(language) unless File.exists?(yml_path(language))\n\n I18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]\n I18n.locale = language\nend",
"def yaml_load(file)\n\t\tYAML.load_file(file.to_s)\n\tend",
"def load\n yaml = YAML.load_file(@file_path)\n yaml.each {|k, v| interpolate_setting(yaml, v)}\n settings = OpenStruct.new\n add_hash(settings, yaml)\n\n @lock.synchronize do\n @yaml = yaml\n @settings = settings\n end\n rescue\n puts \"Failed to load file: #{@file_path}\\n#{$!}\"\n end",
"def locale_translations\n @locale_scope ||= begin\n locale_path = \"#{@locale}.yml\"\n locale_path = File.join(@locales_dir, locale_path) if @locales_dir\n YAML.load_file(locale_path).fetch(@locale)\n end\n end",
"def read\n result = {}\n \n Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|\n yml = YAML::load(IO.read(file))\n hash = @locale ? yml.to_hash[@locale] : yml.to_hash\n result.deep_merge! hash unless hash.nil?\n end\n\n result\n end",
"def load\n yaml_filespec = @filespec.ext('.yaml')\n if File.exist?(yaml_filespec) && (File.mtime(yaml_filespec) > File.mtime(@filespec))\n load_from_yaml(yaml_filespec)\n else\n load_from_xml(@filespec)\n end\n end",
"def load\n YAML.load_file MANIFEST rescue {}\n end",
"def load(file_path, local_variables = {})\n yaml = render file_path, local_variables\n YAML.load yaml\n end",
"def load(path, env)\n yaml_safe_load(File.open(path).read)[env].each do |section, settings|\n section = instance_variable_get(\"@#{section}\")\n next unless section\n settings.each do |setting, value|\n unless section == @index || section == @source\n value = interpolate_string(value, nil)\n end\n setter(section, setting, value)\n end\n end\n end",
"def load_file(filename='~/grapevine.yml')\n filename = File.expand_path(filename)\n hash = YAML.load(File.open(filename))\n load(hash)\n end",
"def test_load_about_missing_locale\n doc = SimpleDocument.read \"folder/about\", :locale => \"fr\"\n \n assert_equal \"#{DIR}/fixtures/folder/about.md\", doc.uri\n end",
"def load\n @filename = File.expand_path(file_name('feeds.yml'))\n end",
"def save_config_file(locale, key)\n locale_config = {}\n locale_config[locale] = {}\n unless @config[key].nil?\n locale_config[locale][key] = @config[key]\n path = \"config/locales/org/#{key}/#{locale}.yml\"\n File.delete(path) if File.exist?(path)\n TTY::File.create_file(path, locale_config.to_yaml)\n end\nend",
"def initialize_from_yaml(path)\n # FIXME: It would be a lot cleaner if the YAML library would raise an\n # exception if it fails to read the file. We'll handle it like this for now\n # load_file just returns \"false\" if it fails\n yaml_data = YAML.load_file(path)\n\n unless yaml_data.nil?\n raise InitializationError.new(\"Bad YAML format, key/value pairs expected\") unless yaml_data.kind_of?(Hash)\n\n yaml_data.each do |variable, value|\n self.store(variable, value)\n end\n end\n\n after_initialize\n dump\n end",
"def load_storage\n YAML.load_file(file_path) || {}\n end",
"def load_settings\n begin\n save = YAML.load_file('settings.yaml')\n unless save\n # the file is empty.. well, not valid YAML\n raise(ArgumentError)\n end\n \n # do something with the loaded values\n @maildirpath = save['maildirpath']\n @known = save['known']\n @ignore = save['ignore']\n @mailers = save['mailers']\n \n rescue Errno::ENOENT, ArgumentError => e\n # file not found or not valid\n # so create a valid one\n File.open('settings.yaml', 'w' ) do |out|\n save = {'maildirpath' => '/path/to/mh/',\n 'known' => {'Firstname Lastname' => ['[email protected]']},\n 'ignore' => ['[email protected]'],\n 'mailers' => {'Mailername' => ['RegEx']}\n }\n YAML.dump(save, out)\n end\n raise(ArgumentError, 'You should check settings.yaml before re-running this program')\n end\n end",
"def dump\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n delete_all unless Interpret.soft\n\n records = []\n files.each do |f|\n ar = YAML.load_file f\n locale = ar.keys.first\n records += parse_hash(ar.first[1], locale)\n end\n\n # TODO: Replace with activerecord-import bulk inserts\n transaction do\n records.each {|x| x.save(:validate => false)}\n end\n end",
"def load_yml(yml_file)\n if File.exist?(yml_file)\n yml_cfg = OpenStruct.new(YAML.load_file(yml_file))\n yml_cfg.jira_properties.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n else\n raise StandardError, \"unable to find yml config file\"\n end\n end",
"def load_library(path)\n data = YAML.load_file(path)\n # maps the data to their proper language despcriptions\n data.map do |key, value|\n data[key] = { english: value[0], japanese: value[1] }\n end\n data\nend",
"def testlocale\n check_path = 'config/locales/'\n locale_list = %w(vi en ja)\n\n @missing_files = []\n @missing_keys = []\n # begin checking if all the necessary locale files exist\n folders = Dir.glob(\"#{check_path}**/*/\").push(check_path)\n for folder in folders do\n key_list = []\n for locale in locale_list do\n file = \"#{folder}#{locale}.yml\"\n if File.exist?(file)\n thing = YAML.load_file(file)\n key_list.push(flatten_keys(thing[locale]))\n else\n @missing_files.push(file)\n end\n end\n key_list.each_with_index do |key1,k1|\n for key2 in key_list do\n missing = key2 - key1\n if missing.any?\n missing.each { |key| @missing_keys.push(\"Missing #{key} in #{folder}#{locale_list[k1]}.yml\") }\n end\n\n end\n end\n end\n\n end",
"def ensure_source_processed(translated_filename)\n return unless $SOURCE.empty?\n\n source_filename = File.dirname(translated_filename) + '/en.yml'\n source_contents = File.read(source_filename)\n original_source = YAML.safe_load(source_contents)\n convert_source('', original_source['en'])\nend",
"def load(environment = nil)\n if !ENV[@env_name].nil?\n @yaml = Zlib::Inflate.inflate(\n Base64.strict_decode64(ENV[@env_name])\n )\n else\n if environment\n env_specific_file_path = \"#{@dir}/#{environment}.yml\"\n if File.exist?(env_specific_file_path)\n file_path = env_specific_file_path\n end\n end\n file_path ||= \"#{@dir}/default.yml\"\n\n @yaml = open(file_path).read\n end\n\n self\n end",
"def load_yml_data\n if File.exist? self.class.file_location\n # YAML.load_file returns false if the file exists but is empty. So\n # added the || {} to ensure we always return a hash from this method\n YAML.load_file(self.class.file_location) || {}\n else\n {}\n end\n end",
"def update\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n\n @languages = {}\n files.each do |f|\n ar = YAML.load_file f\n lang = ar.keys.first\n if @languages.has_key?(lang.to_s)\n @languages[lang.to_s] = @languages[lang.to_s].deep_merge(ar.first[1])\n else\n @languages[lang.to_s] = ar.first[1]\n end\n end\n\n sync(@languages[I18n.default_locale.to_s])\n end",
"def load(file = nil)\n @file = file if file\n @cfg = YAML.load_file(@file)\n end",
"def load_yaml(yaml_file)\n fail \"File #{yaml_file} doesn't exist.\" unless File.exist?(yaml_file)\n # Parse YAML file into a tree of nodes\n # Psych::SyntaxError doesn't inherit from StandardError in some versions,\n # so we want to explicitly catch it if using Psych.\n rescue_errors = [::StandardError, ::Psych::SyntaxError]\n yaml_parsed = File.open(yaml_file, 'r') do |f|\n begin\n YAML.parse(f)\n rescue *rescue_errors => e\n raise \"unable to parse #{yaml_file}: #{e}\"\n end\n end\n return {} unless yaml_parsed\n # Validate the node tree\n validate_yaml(yaml_parsed, yaml_file)\n # If validation passed, convert the node tree to a Ruby Hash.\n yaml_parsed.transform\n end",
"def load\n if @file && File.exist?(@file) && File.stat(@file).size > 0\n h = YAML::load open(@file, 'r').read\n h.each { |k,v| self[k.to_sym] = v}\n return true\n end\n false\n end",
"def dump_yaml!(filepath,translations)\n return if translations.blank?\n FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)\n File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } \n end",
"def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore create an empty hash to act as\n # placeholder\n local = {} if local.nil?\n\n # Recursing to traverse hash\n pairs = templ.collect { |k, v| [k, assemble(v, local[k])] }\n Hash[pairs]\n end\n\n def validate(node, path)\n if node.nil?\n puts \"Warning: path #{path} is nil. \"\n return\n end\n\n return unless node.is_a?(Hash)\n\n node.each { |k, v| validate(v, \"#{path}.#{k}\") }\n end\n\n puts \"Processing file #{filename} of locale #{locale}. \"\n\n # Directories\n locales_dir = Rails.root.join('config/locales')\n templ_dir = locales_dir.join('template')\n local_dir = locales_dir.join(locale)\n output_dir = locales_dir.join(output_locale)\n\n # Loading template\n templ_file = templ_dir.join(filename)\n templ = YAML::load_file(templ_file)['template']\n\n # If the topmost level of the template is not 'template'\n if !templ\n puts \"Warning: Template is nil for #{filename}. Aborting for this file. \"\n return\n end\n\n # Loading localized YAML\n local_file = local_dir.join(filename)\n local = File.exists?(local_file) ? YAML::load_file(local_file)[locale] : {}\n\n # Alert for new file creation\n puts \"Warning: Creating new file #{filename} of locale #{locale}. \" unless File.exists?(local_file)\n\n # Assemble localized strings into template file\n assembled = assemble(templ, local)\n\n # Validate to find missed translations\n validate(assembled, locale)\n\n # Output to file\n output_file = output_dir.join(filename)\n FileUtils.mkdir_p output_file.dirname\n content = {locale => assembled}.to_yaml\n File.open(output_file, 'w') { |f| f.write(content) }\n\n end",
"def load_map_file map_file\n return YAML.load(map_file.read)\nend",
"def load_config\n YAML::load_file(File.join(__dir__, '../config/config.yml'))\n end",
"def yaml_load(file_path)\n YAML.load(File.read(file_path)).to_smash\n end",
"def load_yaml(file, env_vars, my = nil)\n\n yaml = YAML.load_file(file)\n eval_map_values(yaml, env_vars, file, my || yaml)\n end",
"def load_yaml(file, default={})\n default.merge(YAML.load_file(file))\n end",
"def read_config(loc)\n if File.file?(loc) && File.readable?(loc)\n begin\n YAML.safe_load(File.read(loc), [], [], true)\n rescue StandardError => e\n PDK.logger.warn(_(\"'%{file}' is not a valid YAML file: %{message}\") % { file: loc, message: e.message })\n {}\n end\n else\n {}\n end\n end",
"def load_config_from_yaml(path)\n config = load_config(path)\n\n # validate loaded yaml data\n validate_config config\n\n config.each do |key, value|\n Mihari.config.send(\"#{key.downcase}=\".to_sym, value)\n end\n end",
"def load_config_file\n \tproject_name = ENV['PROJECT_NAME']\n \tconfig_file_path = \"#{@configs_folder_path}#{project_name}.yaml\"\n\tif !File.exists?(config_file_path)\n log_message(\"No '#{project_name}.yaml' file found in configs directory.\")\n exit\n end\n @config = YAML.load_file(config_file_path)\n end",
"def load_file(path)\n @configuration_data = YAML.load_file(path)[CONFIGURATION_KEY]\n end",
"def load_yaml_files\n @room_list = YAML.load_file(__dir__ + '/rooms.yml')\n @weapon_list = YAML.load_file(__dir__ + '/weapons.yml')\n @enemy_list = YAML.load_file(__dir__ + '/enemy.yml')\n @high_score_list = YAML.load_file(__dir__ + '/high_score.yml')\n end",
"def load_from_file(path)\n YAML.load_file(path).each { |n,v| instance_variable_set(n, v) }\n end",
"def generate_yaml(locale_name, translations)\n yaml = YamlDocument.new(\"config/locales/translation_#{locale_name}.yml\", locale_name)\n each_value [], translations do |parents, value|\n node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}\n node.value = value\n end\n yaml\n end",
"def yaml(*files, **options, &block) = read(*files, parse: :yaml, ext: ['.yml', '.yaml'], **options, &block)",
"def read_config(loc)\n if PDK::Util::Filesystem.file?(loc) && PDK::Util::Filesystem.readable?(loc)\n require 'yaml'\n\n begin\n YAML.safe_load(PDK::Util::Filesystem.read_file(loc), [], [], true)\n rescue Psych::SyntaxError => e\n PDK.logger.warn _(\"'%{file}' is not a valid YAML file: %{problem} %{context} at line %{line} column %{column}\") % {\n file: loc,\n problem: e.problem,\n context: e.context,\n line: e.line,\n column: e.column,\n }\n {}\n end\n else\n {}\n end\n end",
"def update_translation( key, value, locale )\n \n # lock file\n filename = File::join RAILS_ROOT, \"config/locales\", File::basename( locale + \".yml\" )\n if( File.exists? filename )\n file = File.new( filename, \"r+\")\n else\n file = File.new( filename, \"w+\" ) \n end\n \n file.flock( File::LOCK_EX )\n \n begin \n # read project locale file\n data = YAML.load( file )\n unless data.is_a? Hash \n I18n.load_path << filename\n data = { locale => {} } unless data \n end\n \n tmp = data\n \n # create middle hash keys as needed\n key = locale + \".\" + key\n keys = key.split(/\\./)\n base_key = keys.pop\n \n while tmpkey = keys.shift\n unless tmp[tmpkey].class == Hash\n tmp[tmpkey] = {}\n end\n tmp = tmp[tmpkey]\n end\n \n # update or create value\n tmp[base_key] = value\n \n # save file\n file.truncate( 0 )\n file.rewind\n file.write( data.to_yaml )\n ensure\n # unlock and close file\n file.flock( File::LOCK_UN )\n file.close\n end\n \n I18n.reload!\n \n end",
"def load!(file_path)\n if File.exist? file_path\n @log = YAML.load(File.read(file_path))\n else\n @log = {}\n end\n end",
"def load_file!(file)\n if File.file?(file)\n yaml = %w{.yaml .yml}.include?(File.extname(file))\n text = File.read(file)\n if yaml or /\\A---/ =~ text\n #text = ERB.new(text).result(Object.new.instance_eval{binding})\n data = YAML.load(text)\n data.each do |k,v|\n __send__(\"#{k}=\", v)\n end\n else\n # TODO: Should we really do this here?\n instance_eval(text, file, 0)\n end\n end\n end",
"def read_locale_pack(name, locale: nil)\n pack = LocalePack::Pack.find_by_name(name, locale: locale)\n locale_file_path = File.join(@output_path, pack.file_name)\n\n if !@locale_packs.key?(locale_file_path) && File.exists?(locale_file_path)\n locale_file = File.file?(locale_file_path)\n return '' unless locale_file\n locale_pack_content = File.read(locale_file_path)\n\n @locale_packs[locale_file_path] = locale_pack_content\n end\n\n @locale_packs[locale_file_path]\n end",
"def yml_path language\n Rails.root.join('config', 'locales', \"#{language}.yml\")\nend",
"def read file=STDIN\n\n yaml = case file\n when String\n raise \"Input file not defined\" unless file\n raise \"Input file does not exist\" unless File.exist? file\n raise \"Input file is not readable \" unless File.readable? file\n \n File.read(file)\n when IO\n file.read\n end\n\n raise \"Cannot read YAML data\" unless yaml\n load yaml\n end",
"def loader\n\t\tsave = loader_helper\n\t\tif save\n\t\t\tFile.open(\"saves/#{save}\", 'r'){ |f|\n\t\t\t\treturn YAML.load(f)\n\t\t\t} \n\t\tend\n\t\tfalse\n\tend",
"def load_locale!(locale)\n @projects.each do |project|\n @adapter.allowed_extensions.each do |extension|\n result = project.export locale, extension, @fallback\n\n if result.nil?\n raise \"Could not load project #{project} with extension #{extension} and locale #{locale}\"\n end\n\n strings, plurals = @adapter.parse result, extension\n\n strings = project.filter strings\n plurals = project.filter plurals\n\n warn \"Did not find any strings or plurals in #{project}\" if strings.empty? && plurals.empty?\n\n @strings[locale] = (@strings[locale] || {}).merge(strings)\n @plurals[locale] = (@plurals[locale] || {}).merge(plurals)\n end\n end\n end",
"def load_language(lang)\n puts \"Loading current translations for language #{lang}\"\n system(\n 'curl -X GET ' \\\n \"'https://translation.io/api/v1/segments.json?target_language=#{lang}' \" \\\n \"-H 'x-api-key: #{$API_KEY}' > ,full-list\"\n )\n current_translations_file_contents = File.read(',full-list')\n current_translations_json = JSON.parse(current_translations_file_contents)\n\n if current_translations_json.key?('errors')\n puts 'Error:'\n puts current_translations_json['errors']\n exit 1\n end\n\n # Initialize hash in CURRENT_TRANSLATIONS for this new language\n $CURRENT_TRANSLATIONS[lang] = {}\n\n # Reorganize so that $CURRENT_TRANSLATIONS[lang][key] contains segment\n # information that translations.io provides:\n # id, key, target_language, target, etc.\n current_translations_json['segments'].each do |segment|\n # Work around bug in Rubocop\n if segment['target_language'] != lang\n STDERR.puts \"Error: Expected language #{lang} in segment #{segment}\"\n exit 1\n end\n $CURRENT_TRANSLATIONS[lang][segment['key']] = segment\n end\nend",
"def load_from_yaml(file)\n document_lines = File.readlines(file)\n\n headers = document_lines.enum_for(:each_with_index).\n find_all { |line, _| line =~ /^---/ }\n if headers.empty? || headers.first[1] != 0\n headers.unshift [\"--- name:default\", -1]\n end\n\n options = headers.map do |line, line_number|\n line_options = Hash.new\n line = line.chomp\n line.split(/\\s+/)[1..-1].each do |opt|\n if opt =~ /^(\\w+):(.*)$/\n line_options[$1] = $2\n else\n raise ArgumentError, \"#{file}:#{line_number}: wrong format #{opt}, expected option_name:value, where 'value' has no spaces\"\n end\n end\n line_options['merge'] = (line_options['merge'] == 'true')\n line_options['chain'] = (line_options['chain'] || '').split(',')\n [line_options, line_number]\n end\n options[0][0]['name'] ||= 'default'\n\n options.each do |line_options, line_number|\n if !line_options['name']\n raise ArgumentError, \"#{file}:#{line_number}: missing a 'name' option\"\n end\n end\n\n sections = []\n options.each_cons(2) do |(_, line0), (_, line1)|\n sections << document_lines[line0 + 1, line1 - line0 - 1]\n end\n sections << document_lines[options[-1][1] + 1, document_lines.size - options[-1][1] - 1]\n\n changed_sections = []\n @conf_options = options\n\n sections.each_with_index do |doc, idx|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n result = YAML.load(StringIO.new(doc))\n\n conf_options = options[idx].first\n name = conf_options.delete('name')\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result || Hash.new, conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def from_yaml(filename)\n require \"yaml\" unless defined?(YAML)\n from_hash(YAML.load(IO.read(filename)))\n end",
"def load!(file)\n hash = {}\n YAML.load_file(file).each do |k, v|\n hash[Pathname(k)] = v.map{|vv| Pathname(vv) }\n end\n replace(hash)\n end",
"def yamlfile(file_path)\n ::YAML.load_file(file_path)\n end",
"def yamlfile(file_path)\n ::YAML.load_file(file_path)\n end",
"def load_module_yaml(file_name)\n\t\tFile.open(file_name) { |file| YAML.load(file) }\n\tend"
] | [
"0.70696205",
"0.6927992",
"0.68718296",
"0.682647",
"0.67515993",
"0.6488977",
"0.6488071",
"0.64689696",
"0.64623284",
"0.64623284",
"0.63950026",
"0.63930863",
"0.63771236",
"0.6370306",
"0.63469297",
"0.6322159",
"0.6305526",
"0.62961453",
"0.62848324",
"0.62690824",
"0.62617695",
"0.6209919",
"0.6199794",
"0.6184093",
"0.6169387",
"0.6155544",
"0.61024874",
"0.60944307",
"0.6094012",
"0.60887045",
"0.60753864",
"0.6038011",
"0.6003749",
"0.6000305",
"0.600025",
"0.59892017",
"0.5973864",
"0.5966944",
"0.596629",
"0.5952964",
"0.59503525",
"0.59493405",
"0.5940643",
"0.59268343",
"0.59240615",
"0.590526",
"0.5890564",
"0.5889571",
"0.58654416",
"0.5845617",
"0.5841772",
"0.58331466",
"0.58193094",
"0.5816244",
"0.57885075",
"0.5782934",
"0.57641536",
"0.5761332",
"0.574638",
"0.5744979",
"0.57435924",
"0.5743099",
"0.5737305",
"0.5721331",
"0.57195",
"0.5714441",
"0.5713269",
"0.57096046",
"0.5700296",
"0.5699426",
"0.5693387",
"0.5680064",
"0.56647694",
"0.5663139",
"0.5659519",
"0.5648423",
"0.56367433",
"0.56365675",
"0.5628485",
"0.56275856",
"0.56244904",
"0.56243646",
"0.5620361",
"0.5616987",
"0.55983925",
"0.5596066",
"0.559047",
"0.5582077",
"0.55803984",
"0.5580109",
"0.5578674",
"0.5577021",
"0.55692965",
"0.55683607",
"0.5558499",
"0.5554677",
"0.55513334",
"0.5549176",
"0.5549176",
"0.55488735"
] | 0.68223417 | 4 |
Search and load metas of the current path. | def set_metas_for_current_path
locale_metas_storage.keys.each do |k|
if request.path.match(translate_key_into_regexp(k))
set_metas_from_hash(locale_metas_storage[k].dup)
return
end
end
# if no key match the current path, load default metas if present.
if locale_metas_storage.has_key?('default')
set_metas_from_hash(locale_metas_storage['default'].dup)
else
set_metas_from_hash({})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadir\n @metadir ||= Dir[File.join(root, '{meta,.meta}/')].first || 'meta/'\n end",
"def load_metadata\n begin\n load RAILS_ROOT + '/app/metadata/' + self.name.to_s.underscore + '.rb'\n rescue MissingSourceFile\n end\n end",
"def paths\n @paths ||= fetch('cloudkit-meta')\nend",
"def load_meta cache = true\n meta = if @meta_path.extname == '.yml'\n contents = begin\n @meta_path.read\n rescue Exception => error\n raise QB::Role::MetadataError,\n \"Failed to read metadata file at #{ @meta_path.to_s }, \" +\n \"error: #{ error.inspect }\"\n end\n \n begin\n YAML.load(contents) || {}\n rescue Exception => error\n raise QB::Role::MetadataError,\n \"Failed to load metadata YAML from #{ @meta_path.to_s }, \" +\n \"error: #{ error.inspect }\"\n end\n else\n YAML.load(Cmds.out!(@meta_path.realpath.to_s)) || {}\n end\n \n if cache\n @meta = meta\n end\n \n meta\n end",
"def load_metas_for_locale(locale)\n path = metas_path(locale)\n if File.exists?(path)\n YAML.load(File.open(path))\n else\n logger.error \"[Metaslug] #{path} not found.\"\n {}\n end\n end",
"def live_metadata\n metadatas[full_path] ||= build_metadata\n end",
"def load_all_metas\n Thread.current[:metas] = I18n.available_locales.inject({}) do |acc, locale|\n acc.merge!(load_metas_for_locale(locale))\n acc\n end\n end",
"def metars(params={})\n perform_get('/metars.xml', params)\n end",
"def meta\n File.open(File.join(@load_dir, 'meta.json')) do |f|\n JSON.parse(f.read)\n end\n end",
"def metas\n @metas ||= Metas.new(self)\n end",
"def metadata_lookup(path, ctype=nil, mtype=nil, recursive=false, \n path_only=true, dirs=false)\n entries = []\n prune = recursive ? nil : 2\n @metadata_tree.with_subtree(path, ctype, mtype, prune) do |node|\n entries << [node.node_type, (path_only ? node.path : node)]\n end\n entries\n end",
"def load_metadata(path)\n metadata = Chef::Cookbook::Metadata.new\n if File.exist?(File.join(path, 'metadata.json'))\n metadata.from_json(File.read(File.join(path, 'metadata.json')))\n else\n metadata.from_file(File.join(path, 'metadata.rb'))\n end\n metadata\n end",
"def _lookup!(path)\n found = nil\n\n $LOAD_PATH.each do |base|\n rb_file = File.join( base, \"translation_maps\", \"#{path}.rb\" )\n yaml_file = File.join( base, \"translation_maps\", \"#{path}.yaml\" )\n prop_file = File.join(base, \"translation_maps\", \"#{path}.properties\" )\n\n if File.exist? rb_file\n found = eval( File.open(rb_file).read , binding, rb_file )\n break\n elsif File.exist? yaml_file\n found = YAML.load_file(yaml_file)\n break\n elsif File.exist? prop_file\n found = Traject::TranslationMap.read_properties(prop_file)\n break\n end\n end\n\n # Cached hash can't be mutated without weird consequences, let's\n # freeze it!\n found.freeze if found\n\n return found\n end",
"def meta_walk(path = nil, map = @meta)\n return map unless path and (path.length > 0)\n path.length.times do |i|\n str = path[i]\n unless map.kind_of?(Hash) and map[:dir]\n raise Error.new(Error::NoPath, path[0..i])\n end\n if !(m = map[str]) and !(m = map[:skel])\n raise Error.new(Error::NoPath, path[0..i])\n end\n map = m\n end\n map\n end",
"def find_metadata\n MAPPING.each do |metaname, pattern|\n metapattern = Regexp.new(\"(#{pattern})\\s*:\\s*(.*)\", Regexp::IGNORECASE)\n if text.match(metapattern)\n value = $2\n if value.match(metapattern)\n value = $2\n end\n meta[metaname] = value.strip\n end\n end\n meta\n end",
"def read(path)\n entries[self.class.path(path)]\n end",
"def metas_storage\n Thread.current[:metas]\n end",
"def load_metadata\n version = if self.respond_to?(:chef_version)\n chef_version\n else\n Linter::DEFAULT_CHEF_VERSION\n end\n metadata_path = [version, version.sub(/\\.[a-z].*/, ''),\n Linter::DEFAULT_CHEF_VERSION].map do |version|\n metadata_path(version)\n end.find { |m| File.exist?(m) }\n @dsl_metadata ||= Yajl::Parser.parse(IO.read(metadata_path),\n symbolize_keys: true)\n end",
"def metatags record = nil\n if record.present?\n @metatags ||= Rails.cache.fetch \"#{record.cache_key_with_version}/metatags\" do\n (record.metatags || {}).reverse_merge(default_metatags(record))\n end\n else\n @metatags ||= default_metatags\n end\n end",
"def get_page_meta\n @page_meta = PageMeta.find_by(request_path: request.path)\n end",
"def read!(*path)\n raise Chef::Exceptions::NoSuchAttribute.new(path.join \".\") unless exist?(*path)\n\n path.inject(self) do |memo, key|\n memo[key]\n end\n end",
"def load!(alt_path=nil)\n path = alt_path ? Pathname.new(alt_path) : pathname()\n path.glob('*').each do |file|\n #next if file.to_s.index(/[.]/) # TODO: rejection filter\n name = file.basename #path_to_name(file, path)\n self[name] = get!(file)\n end\n self\n end",
"def meta_retrieve(manifest_path, manifest)\n # TODO: add Tests for Manifest With File Extension\n single_file_lib = PathInfo.new(\"#{manifest_path}/#{manifest}#{PathInfo.new(manifest).with_ext? ? '' : \".#{asset_extension}\"}\")\n\n manifest_dir = \"#{manifest_path}/#{manifest}\"\n indexing_lib = PathInfo.new(\"#{manifest_dir}/index.#{asset_extension}\")\n all_assets_in_manifest_dir = []\n\n real_manifest = nil\n if FileTest.exist?(single_file_lib)\n real_manifest = single_file_lib\n # TODO: refactor => add for a hotfix loading required folders without index\n\n all_assets_in_manifest_dir = [real_manifest.rel]\n else FileTest.exist?(indexing_lib)\n real_manifest = indexing_lib\n\n all_assets_in_manifest_dir = Dir[\"#{manifest_dir}/**/*.#{asset_extension}\"].map { |file| PathInfo.new(file).rel }\n end\n\n # return all_assets_in_manifest_dir if @shallow_retrieval\n\n # TODO add specs for dependent assets sequence\n retrieve_assets_from(real_manifest).flatten\n .concat(all_assets_in_manifest_dir)\n .uniq\n end",
"def metar(id)\n perform_get(\"/metars/#{id}.xml\")\n end",
"def meta_file\n get_file(META_PATH)\n rescue StandardError\n nil\n end",
"def [](type)\n @meta ||= {}\n @meta[type] ||= if File.file?(meta_file_path(type))\n YAML.load(File.read(meta_file_path(type))) || {}\n else\n {}\n end.with_indifferent_access\n end",
"def meta_info_file_pathname\n return @meta_info_file_pathname if @meta_info_file_pathname\n\n @meta_info_file_pathname = RubyFileReader::Reader.meta_info_file_pathname_for(@pathname)\n end",
"def load #:nodoc:\n @found ||= {}\n @loaded ||= {}\n @files ||= Gem.find_files('cartage/*.rb')\n\n @files.reverse.each do |path|\n name = File.basename(path, '.rb').to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end",
"def find(path, type, setting); end",
"def load_metadir(dir=nil)\n data = {}\n Dir[File.join(dir || metadir, '*')].each do |file|\n next unless File.file?(file)\n\n case File.extname(file)\n when '.yaml'\n val = YAML.load(File.new(file))\n data.merge!(val)\n when ''\n val = File.read(file).strip\n val = YAML.load(val) if val =~ /\\A---/\n data[File.basename(file)] = val\n else\n # ignore\n end\n end\n data\n end",
"def locale_metas_storage(locale = I18n.locale)\n metas_storage[I18n.locale.to_s]\n end",
"def load_cached_partial(path, context)\n context.registers[:cached_partials] ||= {}\n cached_partial = context.registers[:cached_partials]\n\n if cached_partial.key?(path)\n cached_partial[path]\n else\n unparsed_file = context.registers[:site]\n .liquid_renderer\n .file(path)\n begin\n cached_partial[path] = unparsed_file.parse(File.read(path, **context.registers[:site].file_read_opts))\n rescue Liquid::Error => e\n e.template_name = path\n e.markup_context = \"included \" if e.markup_context.nil?\n raise e\n end\n end\n end",
"def get(file)\n binding.pry\n #return the values from cached first\n @cached[file] || \n @file_metadata[file] || \n read_metadata_from_yaml(file) || \n cache(file, read_metadata_from_disk(file)) \n end",
"def initialize_metas_storage\n Thread.current[:metas] ||= {}\n end",
"def read!\n path = pathname\n path.glob('*').each do |file|\n #next if file.to_s.index(/[.]/) # TODO: rejection filter\n name = file.basename #path_to_name(file, path)\n self[name] = get!(file) unless key?(name)\n end\n self\n end",
"def get_file_metadatas(path: nil, environment:, recurse: :false, recurselimit: nil, max_files: nil, ignore: nil, links: :manage, checksum_type: Puppet[:digest_algorithm], source_permissions: :ignore)\n validate_path(path)\n\n headers = add_puppet_headers('Accept' => get_mime_types(Puppet::FileServing::Metadata).join(', '))\n\n response = @client.get(\n with_base_url(\"/file_metadatas#{path}\"),\n headers: headers,\n params: {\n recurse: recurse,\n recurselimit: recurselimit,\n max_files: max_files,\n ignore: ignore,\n links: links,\n checksum_type: checksum_type,\n source_permissions: source_permissions,\n environment: environment,\n }\n )\n\n process_response(response)\n\n [response, deserialize_multiple(response, Puppet::FileServing::Metadata)]\n end",
"def find(path); end",
"def find(path); end",
"def file_content(full_path)\n if filepath_match?(full_path, \"**/requirements.{yml,yaml}\")\n REQUIREMENTS\n elsif filepath_match?(full_path, *VAR_FILE_FNMATCHES)\n VAR_DATA\n elsif filepath_match?(full_path, \"**/roles/*/meta/main.{yml,yaml}\")\n META_DATA\n elsif filepath_match?(full_path, \"**/*.{yml,yaml}\")\n dummy_playbook_data_for(full_path.basename)\n end\n end",
"def meta_path\n @@META_MAPPINGS[File.join(controller_path, action_name)]\n end",
"def load_cached_partial(path, context)\n context.registers[:cached_partials] ||= {}\n cached_partial = context.registers[:cached_partials]\n\n if cached_partial.key?(path)\n cached_partial[path]\n else\n unparsed_file = context.registers[:globals]\n .liquid_renderer\n .file(path)\n begin\n # Cache a version of the\n cached_partial[path] = unparsed_file.parse(read_file(path, context))\n rescue Liquid::Error => e\n e.template_name = path\n e.markup_context = \"included \" if e.markup_context.nil?\n raise e\n end\n end\n end",
"def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend",
"def extract_meta\n end",
"def read\n @metadata = {}\n @content = File.read(path)\n\n if @content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n @content = $POSTMATCH\n\n begin\n @metadata = YAML.load($1)\n raise unless @metadata.is_a? Hash\n rescue => ex\n $stderr.puts \"#{File.basename($PROGRAM_NAME)}: #{ex.to_s}\"\n $stderr.puts \"WARNING: Couldn't load metadata.\"\n @metadata = {}\n end\n\n @metadata.symbolize_keys!\n import_metadata\n end\n end",
"def read(path)\n @path = path\n unless File.exist?(info_file)\n debug(\"file #{info_file} missing\")\n write(path, {})\n return\n end\n # data = @info_cacher[info_file]\n info_hash[base_name]\n end",
"def find_object(name)\n @search_paths.unshift(@cache[name]) if @cache[name]\n @search_paths.unshift(Registry.yardoc_file)\n\n # Try to load it from in memory cache\n log.debug \"Searching for #{name} in memory\"\n obj = try_load_object(name, nil)\n return obj if obj\n\n log.debug \"Searching for #{name} in search paths\"\n @search_paths.each do |path|\n next unless File.exist?(path)\n log.debug \"Searching for #{name} in #{path}...\"\n Registry.load(path)\n obj = try_load_object(name, path)\n return obj if obj\n end\n nil\n end",
"def load_all\n return if defined?(@loaded_all)\n\n load_env\n\n paths = search_path\n unless paths.nil?\n paths.each do |dir|\n # dir is already an absolute path\n Dir.glob(File.join(dir, '*.rb')).each do |path|\n # exclude dirs that end with .rb\n load_file(path) if File.file?(path)\n end\n end\n end\n\n @loaded_all = true\n end",
"def load_paths\n @load_paths ||= Config::LoadPaths.new\n end",
"def get_meta(key, default = nil)\n key_str = key.is_a?(Symbol) ? key.to_s : key\n cama_fetch_cache(\"meta_#{key_str}\") do\n option = metas.loaded? ? metas.select{|m| m.key == key }.first : metas.where(key: key_str).first\n res = ''\n if option.present?\n value = JSON.parse(option.value) rescue option.value\n res = (value.is_a?(Hash) ? value.with_indifferent_access : value) rescue option.value\n end\n res == '' ? default : res\n end\n end",
"def mapping\n @meta = data.select { |v| v != 'paths' && v != 'components' } || nil\n @path = data['paths'] || nil\n @model = data.dig('components', 'schemas') || nil\n self\n end",
"def metas_path(locale)\n # TODO: Let user configure it.\n Rails.root.join('config', 'metaslug', \"#{locale}.yml\")\n end",
"def load(path,opts ={})\n options = {:query => Query::Root, :grep => '**/*.*'}.update(opts)\n if File.directory?(path)\n f = File.join(path,options[:grep])\n package('grep:' + f) do\n Dir[f].each do |file|\n package('file:'+file) do\n data = self.read_file(file)\n if data\n xpath = file[path.size..(-1-File.extname(file).size)].split('/')\n xpath.shift if xpath.first == ''\n xquery = options[:query]._(*xpath.map(&:to_sym))\n self.store(xquery.first,data)\n end\n end\n end\n end\n else\n package('file:'+path) do\n data = self.read_file(path)\n if data\n self.store(options[:query].first,data)\n end\n end\n end\n return self\n end",
"def read\n @site.layouts = LayoutReader.new(site).read\n read_directories\n read_included_excludes\n sort_files!\n CollectionReader.new(site).read\n ThemeAssetsReader.new(site).read\n read_data\n end",
"def load_metadata(repo, ref)\n metadata_content = read_content(repo, ref, Ridley::Chef::Cookbook::Metadata::RAW_FILE_NAME)\n cookbook_metadata = Ridley::Chef::Cookbook::Metadata.new\n cookbook_metadata.instance_eval(metadata_content)\n cookbook_metadata\n rescue => ex\n nil\n end",
"def load_file_metadata(file, *fallback_keys)\n path = File.expand_path(file)\n\n keys = if Gem::Requirement.create(\">= #{BASELINE_VERSION}\").satisfied_by?(Gem::Version.new(@version))\n # gather available metadata keys from file if '-m' option is supported\n @sh.run_command(@bin.to_path, '-m', path).split($/)\n elsif fallback_keys.count > 0\n # else use fallback keys (if any)\n fallback_keys.map!(&:to_s)\n warn \"MultiMarkdown version #{@version} does not support the '-m' option.\"\n warn \"Only the following metadata will be queried:#{list_join(*fallback_keys)}\"\n fallback_keys\n end\n keys.each.with_object({}) do |key, data| data[key] = @sh.run_command(@bin.to_path, '-e', key, path) end\n end",
"def read\n site.defaults_reader.read\n site.data = site.collections.data.read.merge_data_resources\n read_layouts\n read_directories\n read_includes\n sort_files!\n read_collections\n site.config.source_manifests.select(&:content).each do |manifest|\n PluginContentReader.new(site, manifest).read\n end\n end",
"def load_metadata\n ret = tar.seek('metadata.yml') do |entry|\n YAML.load(entry.read)\n end\n fail 'metadata.yml not found' unless ret\n @metadata = ret\n ret\n end",
"def lookup!\n $LOAD_PATH.each do |base|\n Dir[File.join(base, *file_lookup_paths)].each do |path|\n path = path.delete_prefix(\"#{base}/\")\n require path\n rescue Exception\n # No problem\n end\n end\n end",
"def read_meta post_file\n separate_yfm_and_content(post_file)\n\n @title = @yfm[\"title\"] \n @layout = @yfm[\"layout\"] || @yfm[\"template\"] || \"default\"\n @permalink = @yfm[\"permalink\"]\n @datetime = Time.parse(@yfm[\"date\"]) || File.mtime(post_file) \n end",
"def load(fact)\n # Now load from the search path\n shortname = fact.to_s.downcase\n load_env(shortname)\n\n filename = shortname + \".rb\"\n\n paths = search_path\n unless paths.nil?\n paths.each do |dir|\n # Load individual files\n file = File.join(dir, filename)\n\n load_file(file) if File.file?(file)\n end\n end\n end",
"def load_paths\n @_load_paths_was = %w(lib models shared).map { |path| Padrino.root(path) }\n @_load_paths ||= @_load_paths_was\n end",
"def load!\n metadata # force lazy evaluation to occur\n\n # re-raise any exception that occurred when reading the metadata\n raise_metadata_error!\n\n load_all_files\n\n remove_ignored_files\n\n if empty?\n raise Exceptions::CookbookNotFoundInRepo, \"The directory #{cookbook_path} does not contain a cookbook\"\n end\n\n cookbook_settings\n end",
"def do_find(path)\n dalli_params = {\n path: path,\n request: 'which_filesets'\n }\n unless (items = cache.read(dalli_params))\n items = {}\n model.find(:all,\n conditions: (\"basename(path) = basename('#{path}') AND \" +\n \"path LIKE '%#{path}'\"),\n order: \"path\",\n include: [ { filesets: :lpp }]).each do |f|\n items[f.path] = ((items[f.path] || []) + f.filesets.map { |fileset| fileset.lpp.name }).sort.uniq\n end\n rc = cache.write(dalli_params, items) # Need to do something with rc\n end\n items\n end",
"def recognize(request, path = request.path)\n response = @root.find(request, path, @splitter.split(path))\n if response && !response.path.dynamic?\n response.path.cached_response = response\n end\n response\n end",
"def enumerate_available path\n trace :loading, \"Enumerating under #{path.inspect}\" do\n Loadable.new(path).\n enumerate.\n map do |filename|\n begin\n require(pathname = path+\"/\"+filename)\n trace :loading, \"Loaded #{pathname}\"\n filename\n rescue LoadError => e\n trace :loading, \"Can't load #{pathname}: #{e.class}: #{e.message} #{e.backtrace[0]}\"\n nil\n rescue Exception => e\n $stderr.puts \"Can't load #{pathname}: #{e.class}: #{e.message} #{e.backtrace[0]}\"\n nil\n end\n end.compact\n end\n end",
"def read_metadata(path)\n unless path\n abort \"Must exist a markdown filename which have Yaml Front Matter.\"\n end\n yml, _ = Maliq::FileUtils.retrieveYFM(File.read path)\n return nil if yml.empty?\n YAML.load(yml).to_symkey\n end",
"def find(path, options={})\n $LOAD_MANAGER.find(path, options)\n end",
"def load_dir!(folder)\n # load meta directory.\n if File.directory?(folder)\n extra = []\n extra_file = File.join(folder, '.rubyextra')\n if File.exist?(extra_file)\n extra = File.read(extra_file).split(\"\\n\")\n extra = extra.collect{ |pattern| pattern.strip }\n extra = extra.reject { |pattern| pattern.empty? }\n extra = extra.collect{ |pattern| Dir[File.join(folder, pattern)] }.flatten\n end\n files = Dir[File.join(folder, '*')]\n files.each do |file|\n next if File.directory?(file)\n next import!(file) if extra.include?(file)\n next import!(file) if %w{.yaml .yml}.include?(File.extname(file))\n next import!(file) if dotruby.key?(File.basename(file))\n end\n end\n end",
"def metadata\n result = store.metadata_for_path(path).dup\n\n file_meta = store.metadata_for_file(source_file).dup\n result.deep_merge!(file_meta)\n\n local_meta = @local_metadata.dup\n result.deep_merge!(local_meta)\n\n result\n end",
"def load\n if File.exist?(@base_file)\n string = File.read(@base_file)\n obj = JSON.parse(string)\n else\n obj = {\n \"target\" => {},\n \"tester\" => {\n \"software\" => \"dolphin\",\n \"version\" => 0.1,\n },\n \"human\" => \"anonymous coward\"\n }\n end\n @config = HashTree[obj]\n\n if File.exist?(@completions_file)\n string = File.read(@completions_file)\n obj = JSON.parse(string)\n else\n obj = []\n end\n @completions = Set.new(obj)\n\n # in case there were manual edits to the file,\n # do completions\n @config.traverse do |node|\n self.add_terms(node.keys)\n node.values.each do |v|\n if v.is_a? String\n self.add_terms(v)\n end\n end\n end\n\n @config.each_path do |path|\n self.add_terms(path.join(\".\"))\n end\n end",
"def meta the_key\n return @top_level[the_key]\n end",
"def get(path)\n key, subkeys = split_path(path)\n if subkeys.any?\n if self[key].is_a?(Droom::LazyHash)\n self[key].get(subkeys)\n else\n nil\n end\n elsif self.key?(key)\n self[key]\n else\n nil\n end\n end",
"def metadata(path, ctype=DEFAULT_CTYPE, mtype=nil)\n ctype ||= DEFAULT_CTYPE # force subtree to include a single ctype \n\n h = {}\n @metadata_tree.with_subtree(path, ctype, mtype, 1) do |node|\n t = node.node_type\n h[t] = node\n # FIXME: should this just return contents?\n #h[t] = node.contents || @metadata_tree.default_data(t)\n end\n\n h\n end",
"def metadata_full_path\n @metadata_full_path ||= \"#{File.dirname(@full_path)}/#{name}\"\n end",
"def metadata_full_path\n @metadata_full_path ||= File.join(File.dirname(@full_path), name)\n end",
"def by_path(path); end",
"def read(*path)\n read!(*path)\n rescue Chef::Exceptions::NoSuchAttribute\n nil\n end",
"def eager_load!\n return unless File.directory?(path)\n\n Dir.entries(path).each do |entry|\n next if entry == \".\" || entry == \"..\"\n name = entry.sub(/(\\.\\w+)+$/, \"\").camelize.to_sym\n if ViewModule.valid_constant_name?(name) && loadable_const_defined?(name)\n mod = const_get(name, false)\n mod.eager_load!\n end\n end\n\n nil\n end",
"def metadata_file\n @metadata_file ||= site.in_source_dir(\".jekyll-metadata\")\n end",
"def load(path); end",
"def scrape_meta_data\n unless @data.meta\n @data.meta!.name!\n @data.meta!.property!\n parsed_document.xpath(\"//meta\").each do |element|\n get_meta_name_or_property(element)\n end\n end\n end",
"def load!\n if(path)\n if(File.directory?(path))\n conf = Dir.glob(File.join(path, '*')).sort.inject(Smash.new) do |memo, file_path|\n memo.deep_merge(load_file(file_path))\n end\n elsif(File.file?(path))\n conf = load_file(path)\n else\n raise Errno::ENOENT.new path\n end\n conf\n end\n end",
"def load\n parsed = JSON.parse(File.read(SPECPATH))\n structs = StructureContainer.new(parsed['PropertyTypes'])\n\n parsed['ResourceTypes'].each do |key, spec|\n match = key.match(/\\A(\\w+)::(\\w+)::(\\w+)\\z/)\n\n register(match[1], match[2], match[3], spec, structs.search(key))\n end\n end",
"def get_path_assets(path)\n redis.smembers path_assets_key(path)\n end",
"def in_cache_dir(*paths); end",
"def at(path); end",
"def find_metadata\n versions.each do |v|\n m = v.metadata\n if m.exist?\n return m\n end\n end\n nil\n end",
"def read_data dir = DIR[:data][:verbs]\n\t\t\tfilepath = File.join dir, \"#{self.class.name.sub('Verbs::','')}.yml\"\n\t\t\treturn {\n\t\t\t\t'keywords' => [self.class.to_s.downcase]\n\t\t\t} unless (File.file? filepath)\n\t\t\treturn YAML.load_file filepath\n\t\tend",
"def fetch\n position, last_dirname = nil, nil\n\n Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|\n next unless File.directory?(filepath) || filepath =~ /\\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/\n\n if last_dirname != File.dirname(filepath)\n position, last_dirname = 100, File.dirname(filepath)\n end\n\n page = self.add(filepath, position: position)\n\n next if File.directory?(filepath) || page.nil?\n\n if locale = self.filepath_locale(filepath)\n Locomotive::Mounter.with_locale(locale) do\n self.set_attributes_from_header(page, filepath)\n end\n else\n Locomotive::Mounter.logger.warn \"Unknown locale in the '#{File.basename(filepath)}' file.\"\n end\n\n position += 1\n end\n end",
"def effective_paths(type)\n smart_paths = @smart_paths\n loader = @loader\n effective_paths = smart_paths[type]\n unless effective_paths\n # type not yet processed, does the various directories for the type exist ?\n # Get the relative dirs for the type\n paths_for_type = LoaderPaths.relative_paths_for_type(type, loader)\n # Check which directories exist in the loader's content/index\n effective_paths = smart_paths[type] = paths_for_type.select { |sp| loader.meaningful_to_search?(sp) }\n end\n effective_paths\n end",
"def locallist()\n # so. if @locationbase/bundles exists\n # gather and merge: @locationbase/bundles/*/@location\n # then merge @locationbase/@location\n #\n\n bundleDir = $cfg['location.bundles'] or 'bundles'\n bundleDir = 'bundles' if bundleDir.nil?\n items = {}\n if (@locationbase + bundleDir).directory? then\n (@locationbase + bundleDir).children.sort.each do |bndl|\n if (bndl + @location).exist? then\n verbose(\"Loading from bundle #{bndl.basename}\")\n bitems = localitems(bndl + @location)\n bitems.map!{|b| b[:bundled] = true; b} # mark items from bundles.\n\n\n # use synckey for quicker merging.\n bitems.each { |b| items[synckey(b)] = b }\n end\n end\n end\n if (@locationbase + @location).exist? then\n bitems = localitems(@locationbase + @location)\n # use synckey for quicker merging.\n bitems.each { |b| items[synckey(b)] = b }\n else\n warning \"Skipping missing location #{@locationbase + @location}\"\n end\n\n items.values\n end",
"def metadata(path)\n resp, data = get(path)\n meta = {}\n\n data.scan(/<input type=\"hidden\" name=\"__([A-Z]+)\" id=\"__[A-Z]+\" value=\"(.*?)\" \\/>/).each do |match|\n meta[\"__#{match[0]}\"] = CGI.escape(match[1])\n end\n\n meta\n end",
"def read_metadata\n @metadata =\n if !disabled? && File.file?(metadata_file)\n content = File.binread(metadata_file)\n\n begin\n Marshal.load(content)\n rescue TypeError\n SafeYAML.load(content)\n rescue ArgumentError => e\n Jekyll.logger.warn(\"Failed to load #{metadata_file}: #{e}\")\n {}\n end\n else\n {}\n end\n end",
"def stack_load_path(path)\n\n ps = path.split('.')\n\n stack_load_global(ps.shift)\n\n while ps.first\n stack_load_field(ps.shift)\n Lib.lua_remove(@pointer, -2)\n end\n end",
"def data_from_path(path, matches, vars)\n data = {}\n return data unless matches\n\n matches.names.each {|var|\n data[var.to_sym] = matches[var]\n }\n\n data\n end",
"def method_missing(method_name)\n if method_name.to_s =~ /^meta_(.*)/\n key = $1\n\n\t#special treatment for opengraph (og:) and twitter card (twitter:) tags\n\tkey.gsub!(\"_\",\":\") if key =~ /^og_(.*)/ || key =~ /^twitter_(.*)/\n\n scrape_meta_data\n\n @data.meta.name && (@data.meta.name[key.downcase]) || (@data.meta.property && @data.meta.property[key.downcase])\n else\n super\n end\n end",
"def meta\n @d[:meta]\n end",
"def lookup_by_path(path, opts = T.unsafe(nil)); end",
"def load_path; end",
"def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = meta_info_file_pathname.read.strip.split(':').map(&:to_i)\n {\n inode: inode,\n bytes_read: bytes_read\n }\n else\n {\n inode: nil,\n bytes_read: 0\n }\n end\n end"
] | [
"0.6425646",
"0.60551155",
"0.60129404",
"0.58988863",
"0.57923436",
"0.57884824",
"0.57586575",
"0.574161",
"0.5679713",
"0.56534654",
"0.5588619",
"0.5571847",
"0.5553067",
"0.5502698",
"0.5482064",
"0.54742455",
"0.54493475",
"0.53832126",
"0.538297",
"0.537925",
"0.53439575",
"0.5322901",
"0.5278946",
"0.52423507",
"0.52303445",
"0.5222952",
"0.5216948",
"0.5210745",
"0.518047",
"0.5146011",
"0.51385254",
"0.51385236",
"0.5134751",
"0.5117432",
"0.51121986",
"0.50861424",
"0.5074127",
"0.5074127",
"0.50470316",
"0.5015906",
"0.5015191",
"0.4993596",
"0.49850258",
"0.49848142",
"0.49561027",
"0.49432805",
"0.49325544",
"0.49237418",
"0.49219528",
"0.4907223",
"0.4894843",
"0.48849258",
"0.4884033",
"0.4873971",
"0.48731348",
"0.48725054",
"0.48656267",
"0.48621473",
"0.4859847",
"0.48566163",
"0.48530465",
"0.4849374",
"0.48471567",
"0.4846715",
"0.48465085",
"0.48406413",
"0.48314393",
"0.48255864",
"0.48235723",
"0.482255",
"0.48059255",
"0.48053086",
"0.4787479",
"0.478273",
"0.47784334",
"0.47629285",
"0.4760111",
"0.4758139",
"0.47470337",
"0.47466254",
"0.4744876",
"0.47431436",
"0.47407627",
"0.47374856",
"0.47329506",
"0.47315666",
"0.4726435",
"0.4725757",
"0.47222334",
"0.4721254",
"0.47133076",
"0.4700408",
"0.46949548",
"0.46924582",
"0.46877503",
"0.46856853",
"0.46802807",
"0.46798527",
"0.46756107",
"0.4674878"
] | 0.70856905 | 0 |
Load metas into an instance variable to have access to them in the helper. Get the instance variables mark as accessible in the before_filter to interpolate values in the liquid template. | def set_metas_from_hash(values)
@metaslug_vars ||= []
# For each meta we need to interpole the value if it use a dynamic content.
values.each do |k ,v|
if v.is_a?(Hash)
# recursive call for nested hash like { 'og' => { 'locale' => { 'alternate' => 'fr_FR' } } }
set_metas_from_hash(v)
else
# Looks like a liquid template
if v =~ /{{.*}}/
if @metaslug_vars.empty?
Rails.logger.debug "You provide a template but don't set access to your vars in the associated controller."
values[k] = v
else
template = Liquid::Template.parse(v)
h = @metaslug_vars.inject({}) do |acc, v|
acc[v.to_s] = instance_variable_get("@#{v}")
acc
end
values[k] = template.render(h)
end
end
end
end
@metaslug = values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_page_meta_vars\n # Interpolate and set @meta_data\n raw_meta = get_meta_config\n second_level_keys = []\n raw_meta.each do |k, v|\n if v.is_a?(Hash)\n second_level_keys << k\n next\n end\n\n if v.is_a?(Array)\n v = @custom_meta[k.to_s]\n else\n v = v % @custom_meta\n end\n\n @meta_data[k] = v\n end\n\n second_level_keys.each do |level2|\n @meta_data[level2] = {}\n raw_meta[level2].each do |k, v|\n if v.is_a?(Array)\n v = @custom_meta[\"#{level2.to_s}_#{k.to_s}\"]\n else\n v = v % @custom_meta\n end\n @meta_data[level2][k] = v\n end\n end\n\n safe_guard_meta\n\n end",
"def meta_data\n #object = instance_variable_get('@'+controller_name.singularize)\n object = instance_variable_get('@resource')\n meta = {}\n\n if object.kind_of? ActiveRecord::Base\n meta[:keywords] = object.meta_keywords if object[:meta_keywords].present?\n meta[:description] = object.meta_description if object[:meta_description].present?\n end\n\n #if meta[:description].blank? && object.kind_of?(Spree::Product)\n # meta[:description] = strip_tags(truncate(object.description, length: 160, separator: ' '))\n #end\n\n meta.reverse_merge!({\n keywords: current_store.meta_keywords,\n description: current_store.meta_description,\n }) if meta[:keywords].blank? or meta[:description].blank?\n meta\n end",
"def metas\n @metas ||= Metas.new(self)\n end",
"def set_extra_stuff\n @templates = Template.all\n @tags = tags_for('Common')\n end",
"def get_instance_vars\n @portfolios = get_portfolios\n @tags = get_tags\n @rails_props = {\n portfolios: @portfolios,\n tags: @tags\n }\n end",
"def _dynamic_page_data\n local_opts = current_page.metadata[:locals]\n local_opts[:dynamic_data_object] ||= Hashie::Mash.new\n return local_opts[:dynamic_data_object]\n end",
"def set_vars_from_context(context)\n self.current_site = context.registers[:site]\n self.current_page = context.registers[:page]\n self.services = context.registers[:services]\n self.current_locale = context.registers[:locale]\n self.page_repository = services.repositories.page\n end",
"def markup_data\n {\n images: images,\n named_images: named_images,\n primary_image: image_urls(@page.image_to_display),\n post_action_image: image_urls(@page.post_action_image_to_display),\n shares: Shares.get_all(@page),\n locale: @page.language&.code || 'en',\n follow_up_url: follow_up_url\n }\n .merge(@page.liquid_data)\n .merge(LiquidHelper.globals(page: @page))\n .merge(plugin_data)\n .deep_stringify_keys\n end",
"def extract_meta\n end",
"def initialize_metas_storage\n Thread.current[:metas] ||= {}\n end",
"def metas_storage\n Thread.current[:metas]\n end",
"def filter_content \n\t\tself.title = ActionView::Base.full_sanitizer.sanitize(self.title)\n\t\tself.slug = ActionView::Base.full_sanitizer.sanitize(self.slug)\n\t\tself.meta_title = ActionView::Base.full_sanitizer.sanitize(self.meta_title)\n\t\tself.meta_keyword = ActionView::Base.full_sanitizer.sanitize(self.meta_keyword)\n\t\tself.meta_description = ActionView::Base.full_sanitizer.sanitize(self.meta_description)\n\t\tself.page_class = ActionView::Base.full_sanitizer.sanitize(self.page_class)\n\tend",
"def meta\n self.class.instance_variable_get(:@__meta)\n end",
"def get_content_vars\n @controller_name = controller_name\n @action_name = action_name\n @default_view_type = session[:view_type]\n @theme_css = theme_css(session[:theme] || @@app_config[:theme])\n @plugin_css = plugin_css 'jquery.ui.css'\n @meta_keywords = @@app_config[:keywords] || @@app_config[:title]\n @meta_description = @@app_config[:description] || @meta_keywords\n @plugins = use_scripts(:plugins, (@@app_config[:plugins] || '').split(/,\\W?/))\n @widgets_js = use_scripts(:widgets, (@@app_config[:widgets] || '').split(/,\\W?/))\n @nav_pages = Page.nav_pages\n @global_blocks = Block.all :conditions => ['show_in_all in (?)', regions(false).map(&:to_s)]\n @user = User.find(params[:user_id]) unless params[:user_id].blank?\n end",
"def site_meta\n end",
"def site_meta\n end",
"def custom_meta_data\n end",
"def get_page_meta\n @page_meta = PageMeta.find_by(request_path: request.path)\n end",
"def get_meta_tags\n if @content_package\n\n if @content_package.meta_image_uid\n image = \"#{Settings.site_url}#{@content_package.meta_image.thumb('1200x630#').url}\"\n elsif @content_package.respond_to?(:hero_image) && @content_package.hero_image.present?\n image = \"#{Settings.site_url}#{@content_package.hero_image.thumb('1200x630#').url}\"\n end\n\n meta_title = @content_package.meta_title.presence || Settings.default_meta_title\n meta_description = @content_package.meta_description.presence || Settings.default_meta_description\n meta_keywords = @content_package.meta_keywords.presence || Settings.default_meta_keywords\n if @content_package.hide_from_robots?\n meta_hide_from_robots = \"<meta name='robots' content='noindex, nofollow' />\\n\"\n end\n\n else\n meta_title = content_for(:title) || Settings.default_meta_title\n meta_description = content_for(:description) || Settings.default_meta_description\n meta_keywords = content_for(:keywords) || Settings.default_meta_keywords\n meta_hide_from_robots = nil\n end\n\n meta_description = strip_tags CGI.unescapeHTML(meta_description.strip)\n\n meta_image = image || content_for(:meta_image) || \"#{Settings.site_url}#{asset_path(Settings.default_fb_meta_image)}\"\n\n meta_values = [meta_title, meta_description, meta_image, meta_keywords, meta_hide_from_robots]\n\n pig_meta_tags(meta_values)\n end",
"def meta\n meta = {}\n set_meta(meta)\n return meta\n end",
"def meta_data\n @meta_data ||= params['metaData']\n end",
"def prep_variables\n end",
"def meta_information\n @meta_hash ||= {}\n end",
"def cacheable_data\n @cacheable_data ||= {}\n .merge(@page.liquid_data)\n .merge(LiquidHelper.globals(page: @page))\n .merge(images: images)\n .merge(named_images: named_images)\n .merge(primary_image: image_urls(@page.image_to_display))\n .merge(shares: Shares.get_all(@page))\n .merge(follow_up_url: follow_up_url)\n end",
"def meta\n @d[:meta]\n end",
"def prepare_meta_tags(options={})\n site_name = I18n.t('meta_tag.site_name')\n title = I18n.t('meta_tag.title')\n description = I18n.t('meta_tag.description')\n image = options[:image] || ActionController::Base.helpers.image_url('/homepage/teaser_bg.jpg')\n current_url = request.url\n\n # Let's prepare a nice set of defaults\n defaults = {\n site: site_name,\n title: title,\n image: image,\n description: description,\n keywords: %w[bookmarks web mobile free application],\n twitter: {\n site_name: site_name,\n site: '@wundermarks',\n card: 'summary',\n description: :description,\n image: image\n },\n og: {\n url: current_url,\n site_name: site_name,\n title: :title,\n image: image,\n description: :description,\n type: 'website'\n }\n }\n\n options.reverse_merge!(defaults)\n\n set_meta_tags options\n end",
"def variables\n super.transform_values do |details|\n if details['type'] == 'Json'\n JSON.parse(details['value'])\n else\n details['value']\n end\n end\n end",
"def show\n locals :extractor => current_extractor\n end",
"def view_assigns\n variables = instance_variables - _protected_ivars\n\n variables.each_with_object({}) do |name, hash|\n hash[name.slice(1, name.length)] = instance_variable_get(name)\n end\n end",
"def variables\r\n if self.template.nil?\r\n template_variables = Template.detect_variables( self.get_template )\r\n else\r\n template_variables = self.template.variables\r\n end\r\n original_variables = self.attributes[\"variables\"] || {}\r\n original_variables.each do |key, value|\r\n template_variables[key] = value if template_variables.keys.include?( key )\r\n end\r\n return template_variables\r\n end",
"def set_variables\n I18n.locale = MySettings.locale || I18n.default_locale\n\n @articles = Article.all\n @categories = Category.all\n @most_used_tags = ActsAsTaggableOn::Tag.most_used(10)\n end",
"def get_meta_config\n get_config[:meta]\n end",
"def metatags record = nil\n if record.present?\n @metatags ||= Rails.cache.fetch \"#{record.cache_key_with_version}/metatags\" do\n (record.metatags || {}).reverse_merge(default_metatags(record))\n end\n else\n @metatags ||= default_metatags\n end\n end",
"def render(*args)\n load_metas_for_current_slug\n super\n end",
"def meta(meta_data)\n @_meta = meta_data\n end",
"def pagy_searchkick_get_vars(_collection, vars)\n pagy_set_items_from_params(vars) if defined?(ItemsExtra)\n vars[:items] ||= DEFAULT[:items]\n vars[:page] ||= (params[vars[:page_param] || DEFAULT[:page_param]] || 1).to_i\n vars\n end",
"def set_static_page_metatags! tags, record\n if record.role == 'home'\n tags['title'] = translate('we_meditate')\n image = MediaFile.find_by(id: record.content_blocks.first['data']['image']['id']) if record.content_blocks.present?\n elsif record.parsed_content.present? && record.parsed_content['mediaFiles'].present?\n image = MediaFile.find_by(id: record.parsed_content['mediaFiles'].first)\n end\n\n tags['og:image'] = image_url image.file_url if image.present?\n tags['og:type'] = 'website' if %w[home contact privacy articles meditations subtle_system].include?(record.role)\n end",
"def set_guide_variables\r\n @region = Region.friendly.find(params[:region_name]) if params[:region_name]\r\n @sport = Sport.friendly.find(params[:sport_name]) if params[:sport_name]\r\n \r\n @title = page_title\r\n @meta_keywords = page_meta_keywords\r\n @meta_description = page_meta_description \r\n end",
"def build_meta_tags(with: Metatags::BaseMetatags, instance: nil)\n self.meta_tags = with.new(instance, view_context)\n end",
"def pagy_elasticsearch_rails_get_vars(vars)\n vars[:page] ||= params[ vars[:page_param] || VARS[:page_param] ] || 1\n vars[:items] ||= VARS[:items]\n vars\n end",
"def initialize\n @meta_tags = ActiveSupport::HashWithIndifferentAccess.new\n end",
"def show\n setup_variables(params)\n\n end",
"def meta\n options[:meta]\n end",
"def get_meta_options\n\n meta = {}\n @params.each do |p|\n match = p[0].match(/^meta_(.*)/)\n if(match)\n meta[$1] = p[1]\n end\n end\n\n return meta\n\n end",
"def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end",
"def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end",
"def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end",
"def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end",
"def define_variables\n @favori = session[:favori] ||= Favori.new\n @theme = User.find_theme(session)\n @language = PlmServices.get_property(:LOCAL_DEFAULT)\n\t @urlbase = \"http://\"+request.env[\"HTTP_HOST\"]\n @themes = get_themes(@theme)\n @languages = get_languages\n ###########TODO inutile @notification=PlmServices.get_property(:NOTIFICATION_DEFAULT)\n ###########TODO inutile @time_zone=PlmServices.get_property(:TIME_ZONE_DEFAULT)\n # mise en forme d'une tache (workitem)\n @payload_partial = 'shared/ruote_forms'\n WillPaginate::ViewHelpers.pagination_options[:previous_label] = t('label_previous')\n WillPaginate::ViewHelpers.pagination_options[:next_label] = t('label_next')\n WillPaginate::ViewHelpers.pagination_options[:page_links ] = true # when false, only previous/next links are rendered (default: true)\n WillPaginate::ViewHelpers.pagination_options[:inner_window] = 10 # how many links are shown around the current page (default: 4)\n WillPaginate::ViewHelpers.pagination_options[:page_links ] = true # when false, only previous/next links are rendered (default: true)\n WillPaginate::ViewHelpers.pagination_options[:inner_window] = 10 # how many links are shown around the current page (default: 4)\n WillPaginate::ViewHelpers.pagination_options[:outer_window] = 3 # how many links are around the first and the last page (default: 1)\n WillPaginate::ViewHelpers.pagination_options[:separator ] = ' - ' # string separator for page HTML elements (default: single space)\n \t@myparams = params\n \t#puts \"fin de define_variables\"\n end",
"def before_load(o={}, &block) \n end",
"def pagy_arel_get_vars(collection, vars)\n pagy_set_items_from_params(vars) if defined?(ItemsExtra)\n vars[:count] ||= pagy_arel_count(collection)\n vars[:page] ||= params[vars[:page_param] || DEFAULT[:page_param]]\n vars\n end",
"def meta_eval\n metaclass.instance_eval\n end",
"def setup(context, options, block)\n @view = context\n @options = options\n @block = block\n\n @locals = options[:locals] ? options[:locals].symbolize_keys : {}\n @details = extract_details(options)\n\n prepend_formats(options[:formats])\n\n partial = options[:partial]\n\n if String === partial\n @has_object = options.key?(:object)\n @object = options[:object]\n @collection = collection_from_options\n @path = partial\n else\n @has_object = true\n @object = partial\n @collection = collection_from_object || collection_from_options\n\n if @collection\n paths = @collection_data = @collection.map { |o| partial_path(o) }\n @path = paths.uniq.one? ? paths.first : nil\n else\n @path = partial_path\n end\n end\n\n if as = options[:as]\n raise_invalid_option_as(as) unless /\\A[a-z_]\\w*\\z/.match?(as.to_s)\n as = as.to_sym\n end\n\n if @path\n @variable, @variable_counter, @variable_iteration = retrieve_variable(@path, as)\n @template_keys = retrieve_template_keys\n else\n paths.map! { |path| retrieve_variable(path, as).unshift(path) }\n end\n\n self\n end",
"def eval_dynamic_attributes\r\n check_page\r\n \r\n #name\r\n @name = @page.instance_eval(&@name) if @name.kind_of? Proc\r\n check_string @name, 'name'\r\n\r\n #title\r\n @title = @page.instance_eval(&@title) if @title.kind_of? Proc\r\n check_string @title, 'title'\r\n \r\n # link\r\n @link = @page.instance_eval(&@link) if @link.kind_of? Proc\r\n check_hash @link, 'link'\r\n \r\n # highlights\r\n @highlights.collect! do |h|\r\n h.kind_of?(Proc) ? @page.instance_eval(&h) : h\r\n end\r\n @highlights.each {|h| check_hash h, 'highlight'}\r\n \r\n # show_if\r\n @condition = @page.instance_eval(@condition) if @condition.kind_of?(String)\r\n @condition = @page.instance_eval(&@condition) if @condition.kind_of?(Proc)\r\n end",
"def page_meta\n @page_meta ||= {}\n end",
"def locals; end",
"def locals; end",
"def locals; end",
"def instance_vars_from_attributes\n self.visibility = @attributes[:visibility]\n self.release_date = (wants_embargo? && @attributes[:embargo_release_date].presence) ||\n (wants_lease? && @attributes[:lease_expiration_date].presence)\n self.after = (wants_embargo? && @attributes[:visibility_after_embargo].presence) ||\n (wants_lease? && @attributes[:visibility_after_lease].presence)\n self.during = (wants_embargo? && @attributes[:visibility_during_embargo].presence) ||\n (wants_lease? && @attributes[:visibility_during_lease].presence)\n end",
"def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end",
"def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end",
"def metadata\n return super if block_given?\n\n @metadata || @view_context.render(@metadata_component.new(fields: presenter.field_presenters, show: show?))\n end",
"def set_meta\n puts 'meta'\n end",
"def set_template_instance_variables(opts)\n opts.each {|k,v| self.instance_variable_set(\"@#{k}\", v) }\n end",
"def parse_tag_metadata_vars(meta)\n begin\n return tag unless meta\n new_tag = tag\n # Direct value metaname var\n # pattern: %V=key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # directly inserts the value or nothing if nil\n direct_value = new_tag.scan(/%V=[\\w ]*-%/)\n direct_value.map! do |dv|\n {\n :var => dv,\n :key_name => dv.gsub(/%V=|-%/, \"\"),\n :value => meta[dv.gsub(/%V=|-%/, \"\")]\n }\n end\n direct_value.each do\n |dv|\n dv[:value] ||= \"\"\n new_tag = new_tag.gsub(dv[:var].to_s,dv[:value].to_s)\n end\n\n\n # Selected value metaname var\n # pattern: %R=selection_pattern:key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # Where 'selection_pattern' is a Regex string for selecting a portion of the value from the key name in the metadata hash\n # directly inserts the value or nothing if nil\n selected_value = new_tag.scan(/%R=.+:[\\w]+-%/)\n selected_value.map! do |dv|\n {\n :var => dv,\n :var_string => dv.gsub(/%R=|-%/, \"\"),\n :key_name => dv.gsub(/%R=|-%/, \"\").split(\":\")[1],\n :pattern => Regexp.new(dv.gsub(/%R=|-%/, \"\").split(\":\").first)\n }\n end\n\n selected_value.each do\n |sv|\n if sv[:pattern] && sv[:key_name]\n sv[:value] = sv[:pattern].match(meta[sv[:key_name]]).to_s\n end\n sv[:value] ||= \"\"\n new_tag = new_tag.gsub(sv[:var].to_s,sv[:value].to_s)\n end\n rescue => e\n logger.error \"ERROR: #{e}\"\n tag\n end\n new_tag\n end",
"def injectable_meta \n set_meta_tags title: \"#{controller_name.humanize.titleize + ' - ' + action_name.capitalize}\",\n description: 'NoBull Software Co.\\'s NoBull Website Ordering Thingy™!👋' ,\n keywords: 'webapp, web site development, business information',\n index: false,\n nofollow: true,\n icon: [\n { href: \"#{ActionController::Base.helpers.asset_path('favicon.ico')}\"},\n { href: \"#{ActionController::Base.helpers.asset_path('favicon-96x96.png')}\", sizes: '32x32 96x96', type: 'image/png' },\n { href: \"#{ActionController::Base.helpers.asset_path('apple-icon.png')}\", rel: 'apple-touch-icon-precomposed', sizes: '32x32', type: 'image/png' },\n ]\n end",
"def parse_tag_metadata_vars(meta)\n begin\n return tag unless meta\n new_tag = tag\n # Direct value metaname var\n # pattern: %V=key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # directly inserts the value or nothing if nil\n direct_value = new_tag.scan(/%V=[\\w ]*-%/)\n direct_value.map! do |dv|\n {\n :var => dv,\n :key_name => dv.gsub(/%V=|-%/, \"\"),\n :value => meta[dv.gsub(/%V=|-%/, \"\")]\n }\n end\n direct_value.each do\n |dv|\n dv[:value] ||= \"\"\n new_tag = new_tag.gsub(dv[:var].to_s,dv[:value].to_s)\n end\n\n\n # Selected value metaname var\n # pattern: %R=selection_pattern:key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # Where 'selection_pattern' is a Regex string for selecting a portion of the value from the key name in the metadata hash\n # directly inserts the value or nothing if nil\n selected_value = new_tag.scan(/%R=.+:[\\w]+-%/)\n selected_value.map! do |dv|\n {\n :var => dv,\n :var_string => dv.gsub(/%R=|-%/, \"\"),\n :key_name => dv.gsub(/%R=|-%/, \"\").split(\":\")[1],\n :pattern => Regexp.new(dv.gsub(/%R=|-%/, \"\").split(\":\").first)\n }\n end\n\n selected_value.each do\n |sv|\n if sv[:pattern] && sv[:key_name]\n sv[:value] = sv[:pattern].match(meta[sv[:key_name]]).to_s\n end\n sv[:value] ||= \"\"\n new_tag = new_tag.gsub(sv[:var].to_s,sv[:value].to_s)\n end\n rescue => e\n logger.error \"ERROR: #{p e}\"\n tag\n end\n new_tag\n end",
"def read_meta(style, item)\n if instance.respond_to?(:\"#{name}_meta\") && instance_read(:meta)\n if (meta = meta_decode(instance_read(:meta)))\n meta[style] && meta[style][item]\n end\n end\n end",
"def show\n @page_title = @blog.title\n # this works because of the before_action method that calls set_blog to retrieve the actual blog title\n @seo_keywords = @blog.body\n end",
"def prepare_liquid_template(template)\n end",
"def add_metafeta(&block)\n instance_eval(&block)\n end",
"def locals\n from_context = Sinatra::IndifferentHash[\n issue_id: context.issue_id,\n issue_author: context.issue_author,\n repo: context.repo,\n sender: context.sender,\n bot_name: bot_name ]\n from_body = get_data_from_issue(params[:data_from_issue])\n\n from_body.merge from_context\n end",
"def add_common_liquid_args(hash={})\n # the site\n hash['site'] = @site\n \n hash['now'] = Time.now\n \n # random artifacts and narratives\n hash['random_narrative'] = @site.random_narrative\n hash['random_item'] = @site.random_item\n \n # path helpers\n hash['home_path'] = root_url(:subdomain => @site.title)\n hash['browse_path'] = new_browse_path(:subdomain => @site.title)\n hash['search_path'] = items_path(:subdomain => @site.title)\n hash['news_path'] = news_posts_path(:subdomain => @site.title)\n hash['about_path'] = about_path(:subdomain => @site.title)\n\n # stats\n hash['item_count'] = Item.count(:conditions => {:site_id => @site.id})\n items = @site.items.map {|i| i.id }.join(', ')\n hash['image_count'] = items.blank? ? 0 : Photo.count(:conditions => [\"item_id in (#{@site.items.map { |s| s.id }.join(', ')})\"])\n hash['media_count'] = items.blank? ? 0 : MediaFile.count(:conditions => [\"item_id in (#{@site.items.map { |s| s.id }.join(', ')})\"])\n \n hash['singular'] = @singular\n hash['plural'] = @plural\n \n # params for maintaining search\n hash['search_query_string'] = get_search_params(params).to_param\n hash['search_params'] = Marshal.dump(get_search_params(params))\n \n return hash\n end",
"def set_attributes_from_header(page, filepath)\n template = Locomotive::Mounter::Utils::YAMLFrontMattersTemplate.new(filepath)\n\n if template.attributes\n attributes = template.attributes.clone\n\n # set the editable elements\n page.set_editable_elements(attributes.delete('editable_elements'))\n\n # set the content type\n if content_type_slug = attributes.delete('content_type')\n attributes['templatized'] = true\n attributes['content_type'] = self.mounting_point.content_types.values.find { |ct| ct.slug == content_type_slug }\n end\n\n page.attributes = attributes\n end\n\n page.template = template\n end",
"def show\n # set_meta_tags MetaTag.new({host: request.host, movie: @movie}).hash_options\n impressionist(@post, nil, { unique: [:session_hash] })\n @post.impressionist_count(:filter => :params)\n\n set_meta_tags title: @post.title,\n site: 'Cat Blog',\n description: @post.summary,\n keywords: @post.keywords,\n og: {\n title:'Cat Blog',\n description: @post.summary,\n type: 'website',\n url: post_url(@post)\n }\n\n\n\n end",
"def safe_attrs\n controller.request.get? ? {} : call(:attrs)\n end",
"def liquid_assigns_for_layout(cms_layout)\n head_content = render(partial: 'layouts/head')\n {\n 'content_for_head' => head_content,\n 'content_for_navbar' => navigation_bar(cms_layout.navbar_classes)\n }\n end",
"def set_shared_vars\n @user = current_user\n @plant \n @symptoms \n @question \n @symptom_assessor\n @symptom_causes\n @user_plants = UserPlant.where(user_id: current_user.id)\n @possible_treatments = []\n end",
"def kopal_layout_before_page_meta\n\n end",
"def meta\n @meta ||= decoded_body[:meta]\n end",
"def metadata(&blk)\n blk.call(object.metadata_attributes) if object.has_metadata?\n nil # This ensures nothing gets written to the template if someone uses '=' to call this.\n end",
"def meta\n {\n source: @host,\n favicon: @favicon,\n url: @url,\n title: title,\n description: @description,\n keywords: keywords,\n image_url: @main_image,\n extractable: extractable?\n }\n end",
"def load_notetags\n super\n init_custom_fields\n end",
"def set_metas_for_current_path\n locale_metas_storage.keys.each do |k|\n if request.path.match(translate_key_into_regexp(k))\n set_metas_from_hash(locale_metas_storage[k].dup)\n return\n end\n end\n\n # if no key match the current path, load default metas if present.\n if locale_metas_storage.has_key?('default')\n set_metas_from_hash(locale_metas_storage['default'].dup)\n else\n set_metas_from_hash({})\n end\n end",
"def meta\n {}\n end",
"def instance_variables() end",
"def extract_meta\n data = @language_package_service.extract_meta(@question.attachment, @template_files)\n { editor_mode: @language.ace_mode, data: data } if data.present?\n end",
"def initialize_metal\n Rails::Rack::Metal.requested_metals = configuration.metals\n Rails::Rack::Metal.metal_paths = [\"#{TRUSTY_CMS_ROOT}/app/metal\"] # reset Rails default to TRUSTY_CMS_ROOT\n Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths\n Rails::Rack::Metal.metal_paths += extension_loader.paths(:metal)\n Rails::Rack::Metal.metal_paths.uniq!\n\n configuration.middleware.insert_before(\n :\"ActionController::ParamsParser\",\n Rails::Rack::Metal, if: Rails::Rack::Metal.metals.any?\n )\n end",
"def __locals__\n\t\t\treturn @locals\n\t\tend",
"def meta_eval(&block)\n metaclass.instance_eval(&block)\n end",
"def render_with aInstVars = {}\n context = Object.new.instance_eval do\n aInstVars.each_pair do |var, val|\n instance_variable_set var, val\n end\n\n binding\n end\n\n result(context)\n end",
"def resource_meta_tags\n meta_tags = [\n current_site.metatags,\n @page.metatags\n ].flatten.inject({}) do |tags, metatag|\n tags.merge(metatag.name => metatag.content)\n end\n\n { image_src: current_site.logo.url }.merge(meta_tags)\n .merge(title: @page.title)\n end",
"def setup_template_params_for_rendering\n @template_params[:fieldsets] = fieldsets\n @template_params[:fieldsets_links] = fieldsets_links\n end",
"def server_context_meta_tag\n data = {\n name: 'server-context',\n 'data-controller-name': controller.class.name.sub(/Controller$/, '').underscore,\n 'data-i18n-locale': I18n.locale,\n 'data-time-zone': ActiveSupport::TimeZone::MAPPING[user_time_zone]\n }\n\n tag(:meta, data)\n end",
"def locals\n @locals\n end",
"def set_layout_variables\n @user = User.find(params[:user_id])\n @posts_count = @user.publication_posts.visible.count\n @subscribers = @user.followers.count\n @categories = @user.publication_categories.newly\n end",
"def read_metadata\n metadata = { :variable_set => read_variable_set }\n set_key_map metadata[:variable_set]\n\n metadata\n end",
"def metatags(**options)\n itemprop = options.dig(:config, :itemprop)\n safe_join(\n options.fetch(:value, []).map { |v| content_tag(:meta, nil, itemprop: itemprop, content: v) }\n )\n end",
"def global_template_data\n {'site' => @site, '__design_id' => @design.id, '__site_id' => @site['id']}\n end",
"def meta\n json_body.fetch('meta', {})\n end"
] | [
"0.64363265",
"0.6032025",
"0.58311236",
"0.57462305",
"0.572849",
"0.56935346",
"0.5650569",
"0.564416",
"0.5608824",
"0.56021845",
"0.5574766",
"0.556561",
"0.5530082",
"0.5524937",
"0.5383627",
"0.5383627",
"0.53734446",
"0.5367578",
"0.5353563",
"0.5329479",
"0.5299358",
"0.5273522",
"0.5263323",
"0.52464736",
"0.5244672",
"0.5235954",
"0.5201501",
"0.51908046",
"0.5188203",
"0.51882",
"0.5173527",
"0.51549864",
"0.5150049",
"0.5147709",
"0.5139449",
"0.5137661",
"0.51331717",
"0.5124538",
"0.5121478",
"0.51038915",
"0.50903255",
"0.50668645",
"0.50538665",
"0.5053783",
"0.5045559",
"0.5045559",
"0.5045559",
"0.5034874",
"0.502687",
"0.49978167",
"0.499176",
"0.49858254",
"0.49723768",
"0.49644977",
"0.4962514",
"0.4951918",
"0.4951918",
"0.4951918",
"0.49512243",
"0.49395034",
"0.49395034",
"0.49288785",
"0.49097118",
"0.49042907",
"0.49025506",
"0.49023706",
"0.48975593",
"0.48856574",
"0.48850796",
"0.48770714",
"0.4870334",
"0.48702055",
"0.4869363",
"0.48629016",
"0.48564893",
"0.48471698",
"0.48470137",
"0.48425552",
"0.4839368",
"0.48359364",
"0.48307052",
"0.48299304",
"0.48292774",
"0.48281407",
"0.4825985",
"0.48167667",
"0.48105657",
"0.48011154",
"0.47986886",
"0.47943094",
"0.47897914",
"0.47892764",
"0.47886688",
"0.47859",
"0.4782514",
"0.47782925",
"0.47740874",
"0.47686404",
"0.47642437",
"0.4763751"
] | 0.61863166 | 1 |
Return path of the YAML file of this locale. | def metas_path(locale)
# TODO: Let user configure it.
Rails.root.join('config', 'metaslug', "#{locale}.yml")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locale_file_path(locale)\n \"config/locales/#{locale}.yml\"\n end",
"def application_mode_file_path locale = locale\n File.join(Translate::Storage.root_dir, \"config\", \"locales\", \"#{locale}.yml\")\n end",
"def yaml_path\n File.join(base_path, \"resource_map.yml\")\n end",
"def yaml_path\n \"#{user_directory}/.yolo/config.yml\"\n end",
"def config_path\n ::Rails.root.to_s + \"/config/#{self.name.split('::').last.underscore.pluralize}.yml\"\n end",
"def yml_path language\n Rails.root.join('config', 'locales', \"#{language}.yml\")\nend",
"def dot_kitchen_yml\n File.join(Dir.pwd, \".kitchen.yml\")\n end",
"def yaml_file\n @yaml_file ||= begin\n filename = self.class.to_s.split(\"::\").last\n filename << \"-#{storage_id}\" if storage_id\n File.join(Config.data_path, package.trigger, \"#{filename}.yml\")\n end\n end",
"def config_file\n File.join(root, 'config.yml')\n end",
"def kitchen_yml\n File.join(Dir.pwd, \"kitchen.yml\")\n end",
"def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end",
"def serialized_filename\n \"#{self.name}.yaml\"\n end",
"def path\n current_localization.path\n end",
"def file_extension\n \"yml\"\n end",
"def config_file\n \"#{confdir}/config.yml\"\n end",
"def filename\n \"#{RAILS_ROOT}/tmp/gnip_status.yml\"\n end",
"def selected_yaml_file\n p = current_impressbox_provisioner\n if p.nil? || p.config.nil? || p.config.file.nil? ||\n !(p.config.file.is_a?(String) && p.config.file.chop.length > 0)\n return 'config.yaml'\n end\n p.config.file\n end",
"def file_path\n \"#{Rails.root}/lib/banned_words.yml\"\n end",
"def yfile\n File.join(dir, 'job.yaml')\n end",
"def yml_directory\n @data_magic_yml_directory ||= 'config'\n end",
"def current_texte_path\n config = File.open('./.config.msh','rb'){|f|Marshal.load(f)}\n config[:last_file_path]\n end",
"def info_file(path = nil)\n File.join(info_dir(path), 'info.yaml')\n end",
"def yml_directory\n return @yml_directory if @yml_directory\n return default_directory if self.respond_to? :default_directory\n nil\n end",
"def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend",
"def yaml_filename(file)\n ::File.basename(file).split('.').first\n end",
"def yaml_file?; end",
"def path\n @configuration.path\n end",
"def definitions_file_path\n Rails.root.join \"config/alchemy/menus.yml\"\n end",
"def get_uplift_config_file \n config_dir_path = get_uplift_config_folder\n file_name = \".vagrant-network.yaml\"\n\n return File.join(config_dir_path, file_name) \n end",
"def definitions_file_path\n Rails.root.join 'config/alchemy/menus.yml'\n end",
"def source_path\n if @site.respond_to?(:in_source_dir)\n @site.in_source_dir(\"_app.yaml\")\n else\n Jekyll.sanitized_path(@site.source, \"_app.yaml\")\n end\n end",
"def path\n @absolute_path.sub(%r{^#{Slimdown.config.location}/(.*)\\.md}, '\\1')\n end",
"def path\n @path ||= File.dirname @config_file\n end",
"def fixture_file(filename)\n File.join fixtures_dir, \"#{filename}.yml\"\n end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def path\n File.join( File::SEPARATOR+'layouts', \"t#{self.theme_id}_r#{self.id}\")\n end",
"def create_filepath(language)\n @dirpath = File.join(LOCALE_DIR + @type + '/' + @dirnames.first)\n File.join(@dirpath + '/' + language + '.yml')\n end",
"def config_filepath(name)\n File.expand_path(\"../fixtures/configs/#{name}.yaml\", __dir__)\nend",
"def config_path\n @config_path ||= 'config/spinach.yml'\n end",
"def destination_path\n if @site.respond_to?(:in_dest_dir)\n @site.in_dest_dir(\"app.yaml\")\n else\n Jekyll.sanitized_path(@site.dest, \"app.yaml\")\n end\n end",
"def raml_file\n return options.fetch(:raml) if options && options.fetch(:raml, nil)\n\n raml_path = File.join(FileUtils.pwd, \"doc\", \"raml\")\n Dir.foreach(raml_path) {|file| return File.join(raml_path, file) if file.match(/\\.raml$/) }\n end",
"def load_yaml(path)\n YAML.load_file File.expand_path(\"../#{path}\", File.dirname(__FILE__))\n end",
"def configuration_path_of(original_path)\n original_path.sub(/\\.#{extention}$/,'.yml')\n end",
"def path\n @path ||= begin\n dir = File.join Dir.home, \".relaton\", \"iec\"\n FileUtils.mkdir_p dir\n File.join dir, \"index.yaml\"\n end\n end",
"def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end",
"def filename\n @filename ||= \"#{ @component.name }-#{(t=Time.now).to_i}-#{t.usec}.yaml\"\n end",
"def path\n path = @file.sub(File.expand_path(root_path), '')\n\n # if xx.haml (but not xx.html.haml), \n if tilt?\n path = path.sub(/\\.[^\\.]*$/, \"\")\n path += \".#{default_ext}\" unless File.basename(path).include?('.')\n end\n\n path\n end",
"def file\n @file ||= File.exist?(FILE) ? FILE : \"#{ENV['HOME']}/.tacos.yml\"\n end",
"def layouts_file_path\n Rails.root.join \"config/alchemy/page_layouts.yml\"\n end",
"def layouts_file_path\n Rails.root.join \"config/alchemy/page_layouts.yml\"\n end",
"def locales_path\n unless defined?(@locales_path)\n self.locales_path = \"#{public_path}/#{DEFAULT_LOCALES_LOCATION}\"\n end\n\n @locales_path\n end",
"def filepath\n File.join(JapaneseNames.root, 'bin/enamdict.min')\n end",
"def database_yml_file\n raise(\":deploy_to in your app/config/deploy/#{fetch(:rails_env)}.rb file cannot contain ~\") if shared_path.to_s.include?('~') # issues/27\n shared_path.join('config/database.yml')\n end",
"def file_path\n PATH_USER_DEFAULTS\n end",
"def manifest_file_name\n basename = name.gsub(/\\.yml/, '') + \".yml\"\n end",
"def config_path\n ENV.fetch(\"SIMPLE_SCHEDULER_CONFIG\", \"config/simple_scheduler.yml\")\n end",
"def file_dumps\r\n Dir.new(translation_base).entries.select{|x| x['.yml']}\r\n end",
"def resource_root\n FilePath.new(build_module.root, name + \".resources\").canonicalize\n end",
"def bundle_directory\n @yaml[\"paths\"][\"bundle_directory\"]\n end",
"def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end",
"def key_path\n @key_path || Utils.filesystem_name(name) + '.pem'\n end",
"def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end",
"def file_path\n dir\n end",
"def yamlfile(file_path)\n ::YAML.load_file(file_path)\n end",
"def yamlfile(file_path)\n ::YAML.load_file(file_path)\n end",
"def plugin_config_file\n File.join(@dir, Config::FILE_NAME)\n end",
"def configuration_file_path; end",
"def schema_dump_path\n File.join ASSETS_ROOT, \"schema_dump_5_1.yml\"\n end",
"def yaml_file?\n YAML_FILE_EXTS.include?(extname)\n end",
"def full_path\n File.dirname(File.expand_path(serialized_filename))\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def state_filename\n File.join(@project.vartmp_dir, '.state.yaml')\n end",
"def configru_path\n @configru_path ||= if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'config.ru')\n else\n new_resource.path\n end\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def path\n if @site.config[\"feed\"] && @site.config[\"feed\"][\"path\"]\n @site.config[\"feed\"][\"path\"]\n else\n \"feed.xml\"\n end\n end",
"def cloud_config_yaml_key\n self.prefix_key('cloud_config.yaml')\n end",
"def cloud_config_yaml_key\n self.prefix_key('cloud_config.yaml')\n end",
"def yaml\n @yaml ||= YAML.load_file path\n rescue StandardError\n {}\n end",
"def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end",
"def config_file\n File.join AppRoot, ConfigFile\n end",
"def path\n # self.id is not accurate, it may use imported theme of design site.\n # on other side, design site may release template first time. current_template_release = nil\n if self.current_template_release.present?\n File.join( File::SEPARATOR+'layouts', \"t#{self.current_template_release.theme_id}_r#{self.release_id}\")\n else\n File.join( File::SEPARATOR+'layouts', \"t#{self.id}_r#{self.release_id}\")\n end\n end",
"def path\n # self.id is not accurate, it may use imported theme of design site.\n # on other side, design site may release template first time. current_template_release = nil\n if self.current_template_release.present?\n File.join( File::SEPARATOR+'layouts', \"t#{self.current_template_release.theme_id}_r#{self.release_id}\")\n else\n File.join( File::SEPARATOR+'layouts', \"t#{self.id}_r#{self.release_id}\")\n end\n end",
"def path\n @file.path\n end",
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def definitions_file_path\n Rails.root.join \"config/alchemy/elements.yml\"\n end",
"def load_yaml(path) # Path must be in /data\n # path must be a yaml file path\n YAML.load_file(File.join(__dir__, \"../data/#{path}.yml\"))\n # YAML keys will be allways strings (never symbols)\n # Returns hash of values (strings)\nend",
"def layout_path\n File.join( \"t#{self.theme_id}_r#{self.id}\", template_theme.file_name( \"ehtml\" ))\n end",
"def default_concierge_variables_path\n Hanami.root.join(\"config\", \"environment_variables.yml\").to_s\n end",
"def load_yaml\n if has_file? \"#{name}.yml\"\n YAML.load_file(path / \"#{name}.yml\").apply_to self\n end\n end",
"def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end",
"def manifest_file_name\n basename = \"#{name}.yml\"\n end",
"def real_path(filename)\n File.join TEMPLATES_DIR, filename\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def obtener_path_parametros_pdf\n File.join(Rails.root, 'lib/mod_marca/lista_publicacion_pdf.yml')\n end",
"def locale_name\n YAML.load(translation || \"{}\").with_indifferent_access[locale] || survey.default_locale_name\n end",
"def path(file)\n File.join File.dirname(__FILE__), '../../templates/', file\n end",
"def default_config_file\n './deadlyzer.yml'\n end",
"def default_config_template_string(filepath)\n if filepath\n filepath = filepath.to_s\n if filepath.end_with?('haml')\n Haml::Engine.new(IO.read(filepath)).render\n else\n IO.read(filepath)\n end\n else\n nil\n end\n end",
"def path\n (public_path + sitemaps_path + filename).expand_path.to_s\n end",
"def dump_yaml!(filepath,translations)\n return if translations.blank?\n FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)\n File.open(filepath, 'w+') { |f| YAML::dump(translations, f) } \n end"
] | [
"0.77636963",
"0.7496513",
"0.7438795",
"0.73593897",
"0.71344894",
"0.7126523",
"0.68006086",
"0.67485815",
"0.6747184",
"0.6680013",
"0.6625028",
"0.64457786",
"0.6444873",
"0.64063424",
"0.6385411",
"0.6336624",
"0.6317528",
"0.62388545",
"0.62371975",
"0.6195002",
"0.6180512",
"0.61738074",
"0.6169957",
"0.6147833",
"0.6145477",
"0.61220413",
"0.6119033",
"0.60916054",
"0.607576",
"0.6073295",
"0.6064916",
"0.6041809",
"0.6031652",
"0.60307777",
"0.60218465",
"0.6020102",
"0.6012809",
"0.5944207",
"0.5927124",
"0.5909373",
"0.590327",
"0.58930355",
"0.5872172",
"0.58530813",
"0.58448344",
"0.58190984",
"0.58122313",
"0.5810354",
"0.5787247",
"0.5787247",
"0.57810104",
"0.57789063",
"0.5776097",
"0.5750889",
"0.574753",
"0.5733818",
"0.57319367",
"0.572124",
"0.57125854",
"0.57112104",
"0.5705285",
"0.57032675",
"0.5697564",
"0.569516",
"0.569516",
"0.5688645",
"0.56870204",
"0.5682942",
"0.5681029",
"0.5671766",
"0.5671609",
"0.56584716",
"0.564886",
"0.56335455",
"0.56276244",
"0.56014377",
"0.56014377",
"0.5599277",
"0.5597359",
"0.5594875",
"0.5580758",
"0.5580758",
"0.5580068",
"0.5580052",
"0.5579427",
"0.557859",
"0.55761594",
"0.55595404",
"0.55503654",
"0.5543854",
"0.5527549",
"0.55245286",
"0.5523515",
"0.55218554",
"0.55199325",
"0.55113715",
"0.5505445",
"0.5500007",
"0.5484922",
"0.54846346"
] | 0.66678846 | 10 |
Metas of the given locale | def locale_metas_storage(locale = I18n.locale)
metas_storage[I18n.locale.to_s]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locales\n locale_counts.keys\n end",
"def locale\r\n read_attribute(:locale).to_sym\r\n end",
"def locales\n map(&:locale)\n end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale; end",
"def locale\n @locales = Ramaze::Tool::Localize.languages.map{ |lang|\n [\n Ramaze::Tool::Localize.localize('locale_menu_descrition', lang),\n Ramaze::Tool::Localize.localize('locale_name', lang),\n lang\n ]\n }\n end",
"def locale\n @locale || { :country => \"US\", :language => \"en\", :variant => nil }\n end",
"def locale\n return @locale\n end",
"def locale\n return @locale\n end",
"def locales\n get(\"locales\")[\"locales\"]\n end",
"def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end",
"def locale\n configatron.ramazon.locale || :us\n end",
"def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def load_all_metas\n Thread.current[:metas] = I18n.available_locales.inject({}) do |acc, locale|\n acc.merge!(load_metas_for_locale(locale))\n acc\n end\n end",
"def locale\n self.padma.try :locale\n end",
"def locale\n @values.fetch('ai.device.locale') { \n @values['ai.device.locale'] = nil\n }\n end",
"def load_metas_for_locale(locale)\n path = metas_path(locale)\n if File.exists?(path)\n YAML.load(File.open(path))\n else\n logger.error \"[Metaslug] #{path} not found.\"\n {}\n end\n end",
"def localizations\n @@locales[Locale.code] || {}\n end",
"def get(locale = Localization.default_locale)\n @locales[locale.to_s]\n end",
"def month\r\n return @hm\r\n end",
"def locale\n I18n.locale.to_s\n end",
"def locale\n I18n.locale.to_s\n end",
"def translated_month_names; end",
"def locale\n if self.language\n LANGUAGE_CODE[self.language]\n end\n end",
"def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end",
"def locale_idx; end",
"def available_locales\n self.locales.map { |locale| locale.to_sym }\n end",
"def locale\n favored_locale\n end",
"def available_locales; end",
"def available_locales; end",
"def name\n n = names\n return nil if n.nil?\n\n @locales.each do |locale|\n return n[locale] if n.key?(locale)\n end\n\n nil\n end",
"def locale\n @grpc.locale\n end",
"def locale\n @grpc.locale\n end",
"def monthly_language_activity\n memoized_language_breakdowns = all_languages_monthly_activity\n\n MONTHS.map do |month|\n res = [Date::MONTHNAMES[month]]\n memoized_language_breakdowns.each do |lang, breakdown|\n value = breakdown.detect { |b| b.fetch(\"month\") == month }\n prs = value ? value.fetch(\"prs\") : 0\n res << prs\n end\n res\n end\n end",
"def units_hash\n {\n \"_hrs\" => \"hours\",\n \"_hours\"=>\"hours\",\n \"_min\"=>\"minutes\",\n \"_minutes\"=>\"minutes\",\n \"_ppm\"=>\"ppm\",\n \"_ppb\"=>\"ppb\",\n \"_mgm3\"=>\"mg/m3\",\n \"_f\"=>\"°f\",\n \"_c\"=>\"°c\",\n \"_rh\"=>\"% rh\",\n \"_utf\"=>\"\"\n }\n end",
"def locales\n @env.locales\n end",
"def locales(locale_type)\n locs = Set.new\n\n each_bathing_water do |bw|\n l = bw[locale_type]\n locs << l if l.is_a?(LdaResource)\n end\n\n locs.to_a.sort_by(&:label)\n end",
"def translated_locales\n self.i18n.keys\n end",
"def descriptions\n I18n.available_locales.map {|l| [l, description(l)] }.to_h\n end",
"def locales\n locale_sources.compact.downcase.map {|loc| WorldFlags.locale(loc) unless loc.blank? }\n end",
"def monthly_language_activity\n @data.fetch(\"activity\")\n end",
"def language\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: language_ordered, values: values )\n return values\n end",
"def verificar_locale\n \n end",
"def default_locale\n (self.locales.first || Locomotive::Mounter.locale).to_sym\n end",
"def locale\n @locale || YodleeApi.locale\n end",
"def locale\n if !language.nil?\n language.abbreviation\n elsif !org.nil?\n org.locale\n end\n end",
"def language\n values = super\n values = MetadataHelper.ordered( ordered_values: self.language_ordered, values: values )\n return values\n end",
"def language\n values = super\n values = MetadataHelper.ordered( ordered_values: self.language_ordered, values: values )\n return values\n end",
"def fecha_marca\n fecha_numero_marca[:fecha]\n end",
"def calc_miss_data(misses)\n miss_data={}\n misses.each_pair do |key, key_data|\n key_result={}\n miss_data[key]=key_result\n if @default_backend\n default_data={}\n @default_backend.available_locales.each do |available_locale|\n default_value = @default_backend.lookup available_locale, key\n default_data[available_locale]= default_value if default_value\n end\n key_result[:default]=default_data unless default_data.empty?\n end\n count_data={}\n key_result[:count]=count_data\n key_data.each_pair do |locale, count|\n count_data[locale.to_sym]=count\n end\n end\n miss_data\n end",
"def each_locale_and_translated_attribute\r\n used_locales.each do |locale|\r\n translated_attribute_names.each do |name|\r\n yield locale, name\r\n end\r\n end\r\n end",
"def meta_og_locale\n LOCALES_TO_IETF.fetch(I18n.locale, 'sv_SE')\n end",
"def locale_matches\n matches = {}\n I18n.available_locales.map(&:to_s).each do |locale|\n matches[locale] = locale\n matches[locale[0, 2]] = locale if locale.length > 2\n end\n matches\n end",
"def default_locale; end",
"def mta\n {\n :N => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], \n :L => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n :L6 => [\"Grand Station\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\nend",
"def query_context_values_for_locale(locale)\n case locale\n when \"US\"\n US_QUERY_CONTEXT_VALUES \n else\n US_QUERY_CONTEXT_VALUES\n end\n end",
"def month_name\r\n return MONTH_NAMES[@hm]\r\n end",
"def translated_locales\r\n all.distinct(\"locale\").sort{ |x,y| x.to_s <=> y.to_s }.map(&:to_sym)\r\n end",
"def each_locale(&block)\n self.mounting_point.locales.each do |locale|\n Locomotive::Mounter.with_locale(locale) do\n block.call(locale)\n end\n end\n end",
"def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(translations.translated_locales)\r\n locales.uniq!\r\n locales\r\n end",
"def translation(locale=nil)\n return translation_for(:value, locale)\n end",
"def locale\n frontmatter_locale = data['locale'] || data['lang']\n filename_locale = path_part('locale') || path_part('lang')\n\n raise \"The locale in #{path}'s filename (#{filename_locale.inspect}) doesn't match the lang in its frontmatter (#{frontmatter_locale.inspect})\" if frontmatter_locale && filename_locale && frontmatter_locale != filename_locale\n\n default_locale = I18n.default_locale if defined? ::I18n\n\n found_locale = frontmatter_locale || filename_locale || default_locale\n found_locale&.to_sym\n end",
"def available_locales_set; end",
"def _calc_locale(_l)\n _l = (_l || @_deco_locale || (h.cama_get_i18n_frontend rescue nil) || I18n.locale).to_s\n \"_#{_l}\"\n end",
"def locale=(_arg0); end",
"def available_locales\n []\n end",
"def hash_is_for_pluralization?(hash, locale)\n plural_keys = I18n.t('i18n.plural.keys', locale: locale)\n raise missing_pluralisations_message(locale) unless plural_keys.is_a?(Array)\n ((hash.keys.map(&:to_s) - plural_keys.map(&:to_s)) - ['zero']).empty?\n end",
"def month_names; end",
"def locale_to_name\n \t\t{'fr' => 'Français',\n 'en' => 'English',\n 'po' => 'portugues',\n 'sp' => 'Spanish',\n 'de' => 'Deutsch',\n 'it' => 'Italiano'}\n\tend",
"def user_languages_hash\n result = Hash.new\n\n I18n.available_locales.each do |locale|\n result[t(\"languages.#{locale.to_s}\")] = locale.to_s\n end\n \n return result\n end",
"def medicinal_uses\n self.object.medicinal_uses.map{|mu| mu.name}.join(', ')\n end",
"def unit_t\n I18n.t \"#{self.unit_s}\", :count => 1\n end",
"def apply_locale; end",
"def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end",
"def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end",
"def locale=(value); end",
"def site_locales\n preferred_locales.split(/,\\s*/)\n end",
"def site_locales\n preferred_locales.split(/,\\s*/)\n end",
"def locale=(locale); end",
"def locale\n defined?(I18n) ? I18n.locale : default_locale\n end",
"def translated_month_names\n key = @options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names'\n I18n.translate(key, locale: @options[:locale])\n end",
"def human\n I18n.t(language, scope: :languages)\n end",
"def po_locale\n @po_locale\n end",
"def read(locale, name)\r\n self[locale][name.to_s]\r\n end",
"def locale_backend; end",
"def t_hash(key)\n translations = {}\n %i[en fr].each do |locale|\n translations[locale] = I18n.t(key, locale: locale, default: key.to_s.titleize)\n end\n translations\n end",
"def preferred_locales\n read_attribute(\"preferred_locales\").map(&:to_sym)\n end",
"def locales\n self.site.locales || []\n end",
"def resolve_runtime_locale_values(hsh)\n hsh.each do |key, value|\n if value.is_a?(Hash)\n meta = value[helpers::META[:meta]]\n if meta && (meta.to_h)[helpers::META[:decorators][:runtime_locales]]\n hsh[key] = get_runtime_locale_value(value)\n else\n hsh[key] = resolve_runtime_locale_values(value)\n end\n end\n end\n return hsh\n end",
"def metrics\n standard.unit.convert_to_metric imperials\n end",
"def character_order = locale_info(:layout, :orientation, :character_order)",
"def for_language(locale)\n translations.select { |word| word.locale == locale }\n end",
"def export_locale(locale)\n @sections_hash.keys.reduce({}) do |memo, section|\n memo[section.name] = export_section_locale(section, locale)\n memo\n end\n end",
"def locale(locale)\n if default?\n locale.to_s\n else\n \"#{self.name}_#{locale.to_s}\"\n end\n end"
] | [
"0.6762398",
"0.630437",
"0.61255014",
"0.6099199",
"0.6099199",
"0.6099199",
"0.6099199",
"0.6099199",
"0.6099199",
"0.6099199",
"0.5858758",
"0.5853041",
"0.58147156",
"0.58147156",
"0.58127326",
"0.5806751",
"0.58064115",
"0.57754076",
"0.57625",
"0.57624805",
"0.5739212",
"0.573796",
"0.5716732",
"0.56913036",
"0.5673548",
"0.564428",
"0.561954",
"0.561954",
"0.5615843",
"0.5590431",
"0.5570353",
"0.55395734",
"0.5521922",
"0.5492737",
"0.54763675",
"0.54763675",
"0.5463001",
"0.54186267",
"0.54186267",
"0.54124445",
"0.5392307",
"0.5391448",
"0.5361367",
"0.5353784",
"0.53534067",
"0.53500205",
"0.5325254",
"0.5319784",
"0.53089106",
"0.529609",
"0.5295525",
"0.5274264",
"0.5252408",
"0.5252408",
"0.5243898",
"0.5221143",
"0.52048105",
"0.52047217",
"0.52025795",
"0.51970696",
"0.5188483",
"0.51719683",
"0.5171512",
"0.51631",
"0.51425576",
"0.51269877",
"0.51253945",
"0.51253074",
"0.5124661",
"0.5114987",
"0.5105433",
"0.510494",
"0.5104928",
"0.5102784",
"0.5100993",
"0.50973535",
"0.5094115",
"0.5089857",
"0.5083218",
"0.5078838",
"0.5078838",
"0.5077633",
"0.5073927",
"0.5073927",
"0.5069521",
"0.50686413",
"0.5067644",
"0.5066987",
"0.5062727",
"0.5055864",
"0.50556433",
"0.5036476",
"0.50316656",
"0.5026149",
"0.5018657",
"0.5016153",
"0.5014924",
"0.501129",
"0.50063676",
"0.5002482"
] | 0.71579176 | 0 |
Backend storage of the metas. We store it in the current thread to avoid reloading it. | def metas_storage
Thread.current[:metas]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_metas_storage\n Thread.current[:metas] ||= {}\n end",
"def storage() @storage; end",
"def storage; end",
"def storage\n @_storage ||= in_memory\n end",
"def metafeta_store\n self.class.metafeta_store\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def metafeta_store\n # This condition ensures that subclasses copy their superclass's metadata.\n # Since subclasses don't need to call 'include Metafeta' they won't have had\n # their @_metafeta_store initialized so we initialize their store the first\n # time it is accessed.\n # A subclass's store is initialized by:\n # 1. Copying the parent's store\n # 2. Running its own metadata spec (if it exists).\n if instance_variable_get(:@_metafeta_store).nil?\n # Deep clone the parent's store. A simple #dup on the store won't suffice\n # since the attributes are stored in an array. #dup only performs a shallow copy.\n new_store = {}\n superclass.metafeta_store.each do |tag, attributes|\n new_store[tag] = attributes.dup\n end\n\n instance_variable_set(:@_metafeta_store, new_store)\n load_metadata\n end\n instance_variable_get(:@_metafeta_store)\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def locale_metas_storage(locale = I18n.locale)\n metas_storage[I18n.locale.to_s]\n end",
"def metas\n @metas ||= Metas.new(self)\n end",
"def store\n Thread.current\n end",
"def store\n @store ||= storage.new self\n end",
"def storage\n Boom.storage\n end",
"def storage_instance; end",
"def cache_store; end",
"def cache_store; end",
"def store\n @store ||= MotionPrime::Store.shared_store\n end",
"def store\n @store ||= {}\n end",
"def store\n @store ||= Globot::Plugins.store.proxy_for(self)\n end",
"def storage\n @storage ||= Set.new\n end",
"def storage\n @storage ||= Set.new\n end",
"def hashback_backend\n self.class.__send__(:class_variable_get, :@@_backend) \n end",
"def stored_data; end",
"def store\n self.class.store\n end",
"def store\n @store ||= begin\n raise \"This is Maglev only\" unless defined?(Maglev)\n # In the future, it might be nice to use something\n # other than an IdentitySet. Set? Bag?\n Maglev::PERSISTENT_ROOT[self.to_s.intern] ||= IdentitySet.new\n end\n end",
"def metatags record = nil\n if record.present?\n @metatags ||= Rails.cache.fetch \"#{record.cache_key_with_version}/metatags\" do\n (record.metatags || {}).reverse_merge(default_metatags(record))\n end\n else\n @metatags ||= default_metatags\n end\n end",
"def preset_lazy_sync\n preset_direct\n use(WCC::Contentful::Middleware::Store::CachingMiddleware,\n ActiveSupport::Cache.lookup_store(*options))\n end",
"def data\n @cache ||= {}\n end",
"def storage\n require 'yaml/store'\n Storage[object_id] ||= YAML::Store.new(STORAGE_FILE)\n end",
"def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end",
"def storage_hash\n JSON.parse(@bot.storage.reload.content || '{}')\n end",
"def store\n @store ||= Hash.new\n end",
"def live_metadata\n metadatas[full_path] ||= build_metadata\n end",
"def store; end",
"def store; end",
"def store; end",
"def instance_cache; end",
"def use\n reload_if_needed\n \n raise(@exception) if @exception\n \n @storage.lock.shared {yield}\n end",
"def metastore\n uri = options['rack-cache.metastore']\n storage.resolve_metastore_uri(uri)\n end",
"def store\n @store ||= Moneta.new(:File, dir: 'ruby-elastic')\n end",
"def store\n @@store ||= Store.get_store(0)\n end",
"def singleton_cache; end",
"def store\n @store ||= Globot::Store.new(Globot.config.for_plugin('database'))\n end",
"def cached?; end",
"def cache\n DataCache\n end",
"def metadir\n @metadir ||= Dir[File.join(root, '{meta,.meta}/')].first || 'meta/'\n end",
"def dynos\n return @dynos.data if @dynos && @dynos.expires_at > Time.now\n @dynos = CacheEntry.new(get_dynos_from_api, Time.now + 60)\n @dynos.data\n end",
"def store\n @store\n end",
"def store\n @store\n end",
"def all\n storage\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def store\n return self.class.store\n end",
"def store_in_cache(request, response)\n response.body = response.body.to_s\n metastore.store(request, response, entitystore)\n nil\n end",
"def store(type, file)\n require_writeable_layers!\n hash = store_immediately!(type, file)\n if layers.delayed.writeable.any?\n Dis::Jobs::Store.perform_later(type, hash)\n end\n hash\n end",
"def store(key, contents)\n raise NotImplementedError.new 'Implement store(key, contents) in your CacheManager'\n end",
"def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\n end",
"def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end",
"def _synced\n @_synced ||= {}\n end",
"def post_store\n engine.post_store\n end",
"def cache(data); end",
"def storage_instance=(_arg0); end",
"def _pack\n class_name = self.class.to_s\n self.__pack = Aqua::Storage.new\n self.__pack.id = @id if @id\n self.__pack[:_rev] = _rev if _rev \n self.__pack[:keys] = []\n self.__pack[:stubs] = []\n self.__pack.merge!( _pack_object( self ) )\n _pack_singletons\n __pack\n end",
"def registered\n return [] if empty?\n\n storage\n end",
"def setup_cache\n @caching_settings ||= {}\n @cache_tmpdir ||= Dir.mktmpdir(CACHE) unless @caching_settings[:metastore]\n @cache_meta = @caching_settings[:metastore] || ('file:' + @cache_tmpdir + '/meta')\n @cache_tmpdir ||= Dir.mktmpdir(CACHE) unless @caching_settings[:entitystore]\n @cache_entity = @caching_settings[:entitystore] || ('file:' + @cache_tmpdir + '/entity')\n @cache_tmpdir || nil\n end",
"def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end",
"def storage_optimization\n @storage_optimization ||= StorageOptimization.new(\n plugin.adapters.values,\n graph.forecast_storage_order\n )\n end",
"def store\n connection.store\n end",
"def in_memory\n {}\n end",
"def in_memory\n {}\n end",
"def in_memory\n {}\n end",
"def store\n Model.model_store.store(self)\n end",
"def cached_stored_files\n @cached_stored_files ||= storage.files\n end",
"def executions\n @storage_class.instance\n end",
"def metadata\n @metadata ||= Mash.new\n end",
"def in_memory\n {}\n end",
"def current_storage\n @attributes[:current_storage]\n end",
"def meta_information\n @meta_hash ||= {}\n end",
"def store?; end",
"def storing\n if block_given?\n yield\n end.tap { persist! if persistible? }\n end",
"def cached\n self\n end",
"def data_caches\n (@data_caches || [])\n end",
"def store= store\n super\n\n @attributes .each do |attr| attr.store = store end\n @constants .each do |const| const.store = store end\n @includes .each do |incl| incl.store = store end\n @extends .each do |ext| ext.store = store end\n @method_list.each do |meth| meth.store = store end\n end",
"def cache\n persist('memory_only_ser')\n end",
"def store!\n raise Dis::Errors::NoDataError unless raw?\n\n Dis::Storage.store(storage_type, raw)\n end",
"def store\r\n return @store\r\n end",
"def install_database\n Qml.const_get(@class).class_eval do\n attr_reader :properties\n attr_accessor :db, :ui_path\n end\n @cache_load << [:attr, @class, \"attr_reader :properties\"]\n @cache_load << [:attr, @class, \"attr_accessor :db, :ui_path\"]\n end",
"def save\n if (not @queued_for_delete.empty?) and @queued_for_write.empty?\n instance_write(:meta, ActiveSupport::Base64.encode64(Marshal.dump({}))) if instance.respond_to?(:\"#{name}_meta=\")\n end\n original_save\n end",
"def cached\n raise NotImplementedError\n end",
"def cache( name, value, created_on )\n meter = Meter.new( :name => name, :value => value, :created_on => created_on, :created_at => Time.now )\n store( name, meter )\n end",
"def stores\n [\n checksum_store,\n compiled_content_cache,\n @dependency_store,\n rule_memory_store,\n ]\n end",
"def storage_class\n @storage_class || storage_loader.storage_class\n end"
] | [
"0.7445612",
"0.6451159",
"0.634262",
"0.6338842",
"0.62993634",
"0.6244727",
"0.6244727",
"0.62022495",
"0.61906624",
"0.61906624",
"0.61906624",
"0.61616457",
"0.6048777",
"0.6037523",
"0.6034586",
"0.60277295",
"0.601253",
"0.6003893",
"0.6003893",
"0.59164345",
"0.5868617",
"0.5819698",
"0.58032286",
"0.58032286",
"0.5760232",
"0.5756828",
"0.5750623",
"0.5732612",
"0.5699436",
"0.5632407",
"0.56290424",
"0.5622944",
"0.5611713",
"0.5605836",
"0.5594396",
"0.5580531",
"0.55726904",
"0.55726904",
"0.55726904",
"0.5562061",
"0.55011374",
"0.5467263",
"0.5452103",
"0.54475343",
"0.54447377",
"0.5430723",
"0.54299355",
"0.5425178",
"0.541916",
"0.5416868",
"0.5414673",
"0.5414673",
"0.54053545",
"0.53856784",
"0.53856784",
"0.53856784",
"0.53856784",
"0.53856784",
"0.53856784",
"0.53856784",
"0.5373307",
"0.5369955",
"0.5367368",
"0.53665346",
"0.5356443",
"0.53406584",
"0.5340128",
"0.5332184",
"0.5329962",
"0.5329821",
"0.5328849",
"0.5320309",
"0.5307796",
"0.53065175",
"0.52933913",
"0.52905834",
"0.5282821",
"0.5282821",
"0.5282821",
"0.5280702",
"0.527864",
"0.5277231",
"0.5274772",
"0.52725226",
"0.5271318",
"0.5270528",
"0.5258041",
"0.5249703",
"0.52477986",
"0.5247321",
"0.52415705",
"0.52350324",
"0.5225098",
"0.5223833",
"0.5218269",
"0.5217363",
"0.5212883",
"0.5209432",
"0.52063245",
"0.5183346"
] | 0.81592125 | 0 |
Initialize storage to an empty hash, unless already set. | def initialize_metas_storage
Thread.current[:metas] ||= {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_data_store\n @data = empty_data_store\n end",
"def initialize_set(h)\n set(h) unless h.empty?\n end",
"def initialize_set(h)\n set(h) unless h.empty?\n end",
"def createEmptyStorage(data_hash, data_source, runId)\r\n data_hash[data_source.to_sym] = {:metrics => [], \r\n :metricsNames => [], \r\n :metricsPass => [], \r\n :metricsComments => [],\r\n :metricsUsage => [], \r\n :urlsToHit => [], \r\n :reason => [],\r\n :dataSource => [], \r\n :runID => runId}\r\n end",
"def createEmptyStorage(data_hash, data_source)\r\n data_hash[data_source.to_sym] = {:metrics => [], \r\n :metricsNames => [], \r\n :metricsPass => [], \r\n :metricsComments => [],\r\n :metricsUsage => [], \r\n :dataSource => []}\r\n end",
"def empty_sha\n @empty_sha ||= git.set(:blob, '')\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @store = {}\n end",
"def initialize\n\t\t\t@hash = {}\n\t\tend",
"def initialize\n @hashes = Hash.new\n bootstrap\n populate\n end",
"def clear\n @storage.empty\n end",
"def hash_set_up\n Hash.new { |hash, key| hash[key] = Array.new(1) { 0 } }\n end",
"def reset_storage_options!\n self.storage_options = storage_options_defaults.dup\n end",
"def initialize\n @memory = Hash.new {|h, k| h[k] = []}\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize_set(h)\n super\n reset_initial_values\n end",
"def ensure_store\n @store ||= LocalStorage.new\n end",
"def initialize()\n\t\t\t#set key by hash unique value\n\t\t\t@key = Digest::SHA1.hexdigest(Time.now.to_s)\n\t\tend",
"def initialize\n empty!\n end",
"def initialize\n empty!\n end",
"def initialize()\n @hash = {}\n @values = []\n end",
"def empty\n @empty ||= new\n end",
"def initialize_defaults\n self.data = {} if data.blank?\n end",
"def initialize( storage={} )\n\t\t@storage = storage\n\tend",
"def initialize(storage = {})\n @storage = storage\n end",
"def initialize\n @hash_dict = {}\n end",
"def empty_storage!\n if storage_exists?\n empty_storage\n else\n raise IOError, \"No banned words file!\"\n end\n end",
"def initialize\n super {|hash, key| hash[key] = 0}\n end",
"def initialize(hash = nil)\n hash.each { |key, value| self[key] = value } if !hash.nil? && hash.is_a?(Hash)\n end",
"def initialize()\n clear()\n end",
"def initialize(hash = EMPTY_HASH)\n raise 'HashDelegator should not be initialized' if instance_of?(HashDelegator)\n\n @hash =\n if self.class.key_transformer\n hash.transform_keys(&self.class.key_transformer)\n elsif hash.frozen?\n hash\n else\n hash.dup\n end\n\n if self.class.default_value.is_a?(Proc)\n @hash.default_proc = self.class.default_value\n else\n @hash.default = self.class.default_value\n end\n\n if self.class.required_attributes\n self.class.required_attributes.each do |attribute|\n attribute = self.class.key_transformer.call(attribute) if self.class.key_transformer\n raise \"#{attribute.inspect} is required, but is missing\" unless key?(attribute)\n end\n end\n end",
"def empty?\n storage.empty?\n end",
"def empty()\n @store.size.zero?\n end",
"def empty()\n @store.size.zero?\n end",
"def init_keystore\n @ks = Hash.new\n @ks[:serial] = 0\n @ks[:family] = Hash.new\n save\n end",
"def initialize\n\t\tself.head = nil\n\t\tself.length = 0\n self.hash = Hash.new\n\tend",
"def reset\n @storage = []\n end",
"def initialize hash\n @hash = hash\n end",
"def clear\n @hash.clear\n self\n end",
"def storage\n @_storage ||= in_memory\n end",
"def reset!\n @storage = in_memory\n end",
"def reset!\n @storage = in_memory\n end",
"def empty?\n storage.empty?\n end",
"def empty?\n storage.empty?\n end",
"def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end",
"def empty?(hash)\n hash unless hash.empty?\n end",
"def initialize()\n @node_cnt = 0;\n @hash_table = Hash.new(); # setup empty hash\n end",
"def initial_state\n {}\n end",
"def _store_defaults\n @store.transaction {@store[@id]= @options} unless valid?\n end",
"def empty(currency = default_currency)\n @empty ||= {}\n @empty[currency] ||= new(0, currency).freeze\n end",
"def clear\n hashed.clear\n list.clear\n end",
"def initialize\n @h = new_hash\n end",
"def initialize\n @hash = lens_keys.map { |k| [k, nil] }.to_h.with_indifferent_access\n end",
"def store\n @store ||= Hash.new\n end",
"def empty?\n @hash.empty?\n end",
"def empty?\n @hash.empty?\n end",
"def initialize(hash, length=nil)\n # No checking is done at this point.\n @elements = hash\n @elements.default = 0\n @size = if length.nil?\n @elements.empty? ? 0 : @elements.keys.max + 1\n else\n length\n end\n end",
"def storage\n @storage ||= Set.new\n end",
"def storage\n @storage ||= Set.new\n end",
"def clear\n @attributes = Hash.new { |hash, key| hash[key] = {} }\n end",
"def initialize\n\t\t@file_table = Hash.new \t\t\t\t\t\t#hash table, unique for each instance\n\tend",
"def initialize(hash, prefix)\n uri = URI.parse(\"memory:#{hash.object_id}\")\n super(uri, prefix)\n @hash = hash\n end",
"def initialize(hash={})\n @hash = hash\n end",
"def hash\r\n @_hash ||= _hash\r\n end",
"def initialize(storage_key)\n @storage = self.class.find_storage(storage_key)\n @storage_key = storage_key.to_sym\n end",
"def initialize\n @db = Hash.new {|hash,grade| hash[grade] = [] }\n end",
"def convert_nils_to_empty_hashes(hash); end",
"def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end",
"def initialize\n clear\n end",
"def init_with_empty\n new({\"name\" => \"\", \"dob\" => \"\", \"maritalStatus\" => \"\", \"mobileNumber\" => \"\", \"email\" => \"\"})\n end",
"def reset!\n @_store = {:default => Configatron::Store.new}\n end",
"def empty?\n @hash.empty?\n end",
"def empty?\n @hash.empty?\n end",
"def empty?\n @hash.empty?\n end",
"def initialize\n clear\n end",
"def initialize_new_test_store\n verify_store_is_blank_for_init\n add_chunk MemoryChunk.new(:max_chunk_size=>max_chunk_size,:max_index_block_size=>max_index_block_size)\n end",
"def clear\n @next = nil\n @size = 0\n @stored = {}\n nil\n end",
"def init_empty\n @content = \"\\x00\".force_encoding(Encoding::BINARY) * PAGE_SIZE\n @type = self.class.to_s.split(\"::\")[-1].intern\n @type_id = TYPES_IDS[@type]\n raise StorageError, \"Page type #{self.class} has no type id.\" unless @type_id\n @content[0...TYPE_SIZE] = encode_int(@type_id, TYPE_SIZE)\n end",
"def initialize(*args)\n super\n # hash = {}\n end",
"def storage\n @storage ||= in_memory\n end",
"def storage\n @storage ||= in_memory\n end",
"def initialize(storage = [])\n @storage = storage\n end",
"def initialize\n @cache = {}\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end"
] | [
"0.68052244",
"0.6501761",
"0.6501761",
"0.6500929",
"0.6499756",
"0.6346581",
"0.6072689",
"0.6072689",
"0.60171896",
"0.6012453",
"0.5941281",
"0.5935431",
"0.59278864",
"0.59224373",
"0.5916707",
"0.5892271",
"0.586267",
"0.58485067",
"0.5829325",
"0.5808723",
"0.5808723",
"0.57953554",
"0.5784996",
"0.5755558",
"0.5743656",
"0.5740894",
"0.57286656",
"0.56948847",
"0.56842107",
"0.5661756",
"0.5656201",
"0.56451255",
"0.5623819",
"0.56199944",
"0.56199944",
"0.56095815",
"0.56078637",
"0.5551591",
"0.5551204",
"0.5539863",
"0.55332977",
"0.55319995",
"0.5530623",
"0.55248064",
"0.55248064",
"0.5523614",
"0.5521542",
"0.5513086",
"0.5507691",
"0.5501211",
"0.54843175",
"0.54770654",
"0.54765594",
"0.54713976",
"0.5469429",
"0.5454199",
"0.5454199",
"0.5444051",
"0.54437304",
"0.54437304",
"0.5441403",
"0.5431162",
"0.54221565",
"0.54215866",
"0.5416134",
"0.5406971",
"0.54031",
"0.53836143",
"0.53758806",
"0.537364",
"0.5366832",
"0.5361688",
"0.53563184",
"0.53563184",
"0.53563184",
"0.53486246",
"0.5342807",
"0.5339157",
"0.5337114",
"0.5334427",
"0.53281194",
"0.53281194",
"0.5323086",
"0.5319569",
"0.53191215",
"0.531746",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772",
"0.5316772"
] | 0.56249 | 32 |
YAML entries may looks like routes, like /categories/:id/edit. To be able to test these entries, we convert them to regexp, replacing :id (and others sym) | def translate_key_into_regexp(k)
# replace :id with regular expression
%r{^#{k.gsub /\:\w+/, '[a-z0-9_.-]+'}$}i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def routes(context={})\n \n routes = [{:path => '/admin/cms',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/cms/,\n :title => 'Gestor contenidos',\n :description => 'Gestiona los contenidos',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content-types',\n :parent_path => '/admin/cms',\n \t :regular_expression => /^\\/admin\\/cms\\/content-types/, \n :title => 'Tipos de contenido' , \n :description => 'Manages the content types: creation and update of content types.',\n :fit => 3,\n :module => :cms},\n {:path => '/mctype/:type/:aspect',\n :parent_path => \"/mctypes\",\n :regular_expression => /^\\/mctype\\/.+\\/.+/, \n :title => 'Content type aspect configuration', \n :description => 'Edit the content type/aspect configuration',\n :fit => 1,\n :module => :cms}, \n {:path => '/admin/cms/contents',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/content/, \n :title => 'Contenidos', \n :description => 'Manages the contents',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content/new/',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/content\\/new/, \n :title => 'Crear contenido', \n :description => 'Create a new content: Choose the content type.',\n :fit => 2,\n :module => :cms},\n {:path => '/admin/cms/content/new/:content_type',\n :parent_path => \"/admin/cms/content/new/\",\n :regular_expression => /^\\/admin\\/cms\\/content\\/new\\/.+/, \n :title => 'Nuevo', \n :description => 'Create a new content: Complete data.',\n :fit => 3,\n :module => :cms}, \n {:path => '/admin/cms/content/edit/:content_id',\n :parent_path => '/admin/cms/contents',\n :regular_expression => /^\\/admin\\/cms\\/content\\/edit\\/.+/, \n :title => 'Editar contenido', \n :description => 'Editar contenido',\n :fit => 1,\n :module => :cms}, \n {:path => '/admin/cms/taxonomy',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/taxonomy/, \n :title => 'Taxonomías', \n :description => 'Manages the taxonomies: creation and update of taxonomies',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/terms/:taxonomy_id',\n :parent_path => \"/admin/cms/taxonomy\",\n :regular_expression => /^\\/admin\\/cms\\/terms\\/.+/, \n :title => 'Term',\n :description => 'Manage the terms of a taxonomy.',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/templates',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/templates/, \n :title => 'Plantillas', \n :description => 'Manages templates: creation and update of templates',\n :fit => 1,\n :module => :cms }, \n {:path => '/admin/cms/comments',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/comments/, \n :title => 'Comentarios', \n :description => 'Manages comments: creation and update of templates',\n :fit => 1,\n :module => :cms }, \n {:path => '/admin/cms/blocks',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/blocks/, \n :title => 'Bloques', \n :description => 'Manage the blocks. It allows to discover and configure modules blocks',\n :fit => 1,\n :module => :cms},\n {:path => '/admin/cms/views',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/views/, \n :title => 'Vistas', \n :fit => 1,\n :description => 'Manage the views: creation and update of views',\n :module => :cms},\n {:path => '/content/:page',\n :regular_expression => /^\\/content\\/.+/,\n :title => 'Content',\n :description => 'Shows a content',\n :fit => 1,\n :module => :cms},\n {:path => '/contents/category/:term_id',\n :regular_expression => /^\\/contents\\/category\\/.+/,\n :title => 'Contents by category',\n :description => 'Shows all the contents tagged with the category',\n :fit => 1,\n :module => :cms},\n {:path => '/admin/cms/menu-management',\n :parent_path => '/admin/cms',\n :regular_expression => /^\\/admin\\/cms\\/menu-management/, \n :title => 'Menu', \n :description => 'Manages the menus: creation and update of menus',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/menu-item-management/:menu_name',\n :parent_path => '/admin/cms/menu-management',\n :regular_expression => /^\\/admin\\/cms\\/menu-item-management\\/.+/, \n :title => 'Elemento de menú',\n :description => 'Manage the items of a menu.',\n :fit => 1,\n :module => :cms },\n {:path => '/admin/cms/translate/content/:content_id',\n :parent_path => '/admin/cms/contents',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/content\\/.+/, \n :title => 'Traducir contenido', \n :description => 'Translate a content',\n :fit => 1,\n :module => :translation },\n {:path => '/admin/cms/translate/menuitem/:menuitem_id',\n :parent_path => '/admin/cms/menu-management',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/menuitem\\/.+/, \n :title => 'Traducir elemento de menu', \n :description => 'Translate a menu item',\n :fit => 1,\n :module => :translation }, \n {:path => '/admin/cms/translate/term/:term_id',\n :parent_path => '/admin/cms/taxonomy',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/term\\/.+/, \n :title => 'Traducir término',\n :description => 'Translate a term.',\n :fit => 1,\n :module => :translation },\n {:path => '/admin/cms/translate/template/:template_id',\n :parent_path => '/admin/cms/templates',\n :regular_expression => /^\\/admin\\/cms\\/translate\\/template\\/.+/, \n :title => 'Traducir plantilla',\n :description => 'Translate a term.',\n :fit => 1,\n :module => :translation } \n ]\n \n end",
"def map_dynamic_segments(route)\n segments = route.to_s.split('/')\n segments.map! do |segment|\n if segment =~ /:/\n '.*'\n else\n segment\n end\n end\n\n segments.join('/')\n end",
"def replace_slugs(markdown, toc_map)\n markdown.gsub(/(\\[\\[slug:)(.+?)(\\]\\])/) {\n if $2.start_with?('en:')\n val = \"[[#{$2}]]\"\n elsif toc_map.key?($2)\n itm = toc_map[$2]\n href = get_page_from_anchor(itm[:href])\n val = '<a href=\"%s\">%s</a>' % [href, itm[:title]]\n else\n val = \"#{$1}#{$2}#{$3}\"\n msg = \"ERROR: Not able to find slug \\\"#{$2}\\\" in TOC.\"\n print_error_msg(msg)\n end\n val\n }\n end",
"def parse_entries(name)\n entries = config.scan(/^route-map\\s#{name}\\s.+$/)\n return nil if entries.empty?\n entries.each_with_object({}) do |rm, response|\n mdata = /^route-map\\s(.+)\\s(.+)\\s(\\d+)$/.match(rm)\n rule_hsh = parse_rules(get_block(rm))\n if response[mdata[2]]\n response[mdata[2]].merge!(mdata[3].to_i => rule_hsh)\n else\n response[mdata[2]] = { mdata[3].to_i => rule_hsh }\n end\n end\n end",
"def test_routes\n assert_routing(\n { :path => \"/diary\", :method => :get },\n { :controller => \"diary_entry\", :action => \"list\" }\n )\n assert_routing(\n { :path => \"/diary/language\", :method => :get },\n { :controller => \"diary_entry\", :action => \"list\", :language => \"language\" }\n )\n assert_routing(\n { :path => \"/user/username/diary\", :method => :get },\n { :controller => \"diary_entry\", :action => \"list\", :display_name => \"username\" }\n )\n assert_routing(\n { :path => \"/diary/friends\", :method => :get },\n { :controller => \"diary_entry\", :action => \"list\", :friends => true }\n )\n assert_routing(\n { :path => \"/diary/nearby\", :method => :get },\n { :controller => \"diary_entry\", :action => \"list\", :nearby => true }\n )\n\n assert_routing(\n { :path => \"/diary/rss\", :method => :get },\n { :controller => \"diary_entry\", :action => \"rss\", :format => :rss }\n )\n assert_routing(\n { :path => \"/diary/language/rss\", :method => :get },\n { :controller => \"diary_entry\", :action => \"rss\", :language => \"language\", :format => :rss }\n )\n assert_routing(\n { :path => \"/user/username/diary/rss\", :method => :get },\n { :controller => \"diary_entry\", :action => \"rss\", :display_name => \"username\", :format => :rss }\n )\n\n assert_routing(\n { :path => \"/user/username/diary/comments\", :method => :get },\n { :controller => \"diary_entry\", :action => \"comments\", :display_name => \"username\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/comments/1\", :method => :get },\n { :controller => \"diary_entry\", :action => \"comments\", :display_name => \"username\", :page => \"1\" }\n )\n\n assert_routing(\n { :path => \"/diary/new\", :method => :get },\n { :controller => \"diary_entry\", :action => \"new\" }\n )\n assert_routing(\n { :path => \"/diary/new\", :method => :post },\n { :controller => \"diary_entry\", :action => \"new\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1\", :method => :get },\n { :controller => \"diary_entry\", :action => \"view\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/edit\", :method => :get },\n { :controller => \"diary_entry\", :action => \"edit\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/edit\", :method => :post },\n { :controller => \"diary_entry\", :action => \"edit\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/newcomment\", :method => :post },\n { :controller => \"diary_entry\", :action => \"comment\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/hide\", :method => :post },\n { :controller => \"diary_entry\", :action => \"hide\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/hidecomment/2\", :method => :post },\n { :controller => \"diary_entry\", :action => \"hidecomment\", :display_name => \"username\", :id => \"1\", :comment => \"2\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/subscribe\", :method => :post },\n { :controller => \"diary_entry\", :action => \"subscribe\", :display_name => \"username\", :id => \"1\" }\n )\n assert_routing(\n { :path => \"/user/username/diary/1/unsubscribe\", :method => :post },\n { :controller => \"diary_entry\", :action => \"unsubscribe\", :display_name => \"username\", :id => \"1\" }\n )\n end",
"def section_id\n match_in_id /\\/(\\w+)$/\n end",
"def params_key(k)\n key = k.to_s.camelize\n key.gsub('Id', 'ID')\n end",
"def parse_params(params)\n collection, id = params['captures']\n enforce_plural(collection)\n id ? [collection, id] : collection\n end",
"def alter_regex_for_custom_routes(node); end",
"def expand_routes(*slice)\n expanded = parent_resource.expand_routes(route_variables)\n\n unless slice.empty?\n expanded = expanded.send(:slice, *slice)\n end\n\n expanded.transform_keys do |key|\n \"#{ key }_url\"\n end\n end",
"def map(params)\n if params.is_a? Array\n params.each { |p| map p }\n elsif params.is_a? String or params.is_a? Symbol\n map Yummi::Helpers::load_resource(params, :from => :patterns)\n else\n config params\n end\n end",
"def reverse_mapping\n @@reverse_mapping ||= Hash[Danbooru.config.full_tag_config_info.map { |k, v| [v[\"category\"], k] }]\n end",
"def routes(context={})\n \n routes = [{:path => '/admin/aspects',\n \t :regular_expression => /^\\/admin\\/config\\/aspects/, \n :title => 'Aspects' , \n :description => 'Configure the aspects.',\n :fit => 1,\n :module => :aspects},\n {:path => '/admin/aspect/:model_name/:aspect',\n :parent_path => \"/model-aspects\",\n :regular_expression => /^\\/admin\\/config\\/aspect\\/.+\\/.+/, \n :title => 'Model aspect configuration', \n :description => 'Edit the model/aspect configuration',\n :fit => 1,\n :module => :aspects\n }]\n \n end",
"def routes(context={})\n \n routes = [{:path => '/admin/media',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/media/,\n :title => 'Medios',\n :description => 'Gestión de medios',\n :fit => 1,\n :module => :media_gallery}, \n {:path => '/admin/media/config',\n :parent_path => '/admin/media',\n :regular_expression => /^\\/admin\\/media\\/config/,\n :title => 'Configuración',\n :description => 'Configuración medios',\n :fit => 1,\n :module => :media_gallery}, \n {:path => '/admin/media/album',\n :parent_path => '/admin/media',\n :regular_expression => /^\\/admin\\/media\\/album/,\n :title => 'Albums',\n :description => 'The albums admin tools to create and modify media albums',\n :fit => 1,\n :module => :media_gallery}, \n {:path => '/admin/media/photo/:album_name',\n :parent_path => '/admin/media/album',\n :regular_expression => /^\\/admin\\/media\\/photo\\/.+/,\n :title => 'Photos',\n :description => 'It manages the album\\'s photos. Used to upload and edit the album\\'s photos.',\n :fit => 1,\n :module => :media_gallery},\n {:path => '/gallery/:album_name',\n :regular_expression => /^\\/photo_gallery\\/.+/,\n :title => 'Photos',\n :description => 'It shows the album\\'s photos.',\n :fit => 1,\n :module => :media_gallery}]\n \n end",
"def routes_map; end",
"def named_routes=(_arg0); end",
"def subsection\n clean_path((params[:subsection] || params[:id]).sub(/\\.md$/, ''))\n end",
"def resource_regexp(url)\n %r{#{url}/[a-z0-9]+_id$}\nend",
"def around_recognition(route, path, env, &block)\r\n unless path =~ %r(^/admin) # TODO ... should be defined through the dsl in routes.rb\r\n if match = path.match(@@pattern)\r\n section = Site.find_by_host(env[:host_with_port]).sections.root\r\n path.sub! /^#{match[0]}/, \"#{match[1]}/#{section.type.pluralize.downcase}/#{section.id}#{match[2]}\"\r\n end\r\n end\r\n yield path, env\r\n end",
"def permalink\n \"/entries/#{slug}\"\n end",
"def routing_key; opt('routing_key'); end",
"def add_to_routes m\n file_to_update = 'config/routes.rb'\n line_to_add = \"map.resources :casein_#{controller_file_name}\"\n insert_sentinel = 'CaseinAddRoutes::mapper map'\n gsub_add_once m, file_to_update, \" \" + line_to_add, insert_sentinel\n logger.route line_to_add\n end",
"def configuration_fixtures\n {\n 'can create a single route' => {\n input: %q{\n /api:\n /resource:\n 1\n },\n output: {\n '/api/resource' => 1\n }\n },\n 'can create multiple nested routes' => {\n input: %q{\n /entry_1:\n /resource_a:\n 1\n /resource_b:\n /nested_a:\n 2\n /nested_b:\n 3\n /entry_2:\n /resource_c:\n 4\n },\n output: {\n '/entry_1/resource_a' => 1,\n '/entry_1/resource_b/nested_a' => 2,\n '/entry_1/resource_b/nested_b' => 3,\n '/entry_2/resource_c' => 4\n }\n },\n 'allows non-bottom level routes to return a value' => {\n input: %q{\n /api:\n /resource:\n 1\n $body: 2\n },\n output: {\n '/api/resource' => 1,\n '/api' => 2\n }\n },\n 'allows the specification of a return status code' => {\n input: %q{\n /api:\n /resource_1: 'result'\n /resource_2:\n $status: 301\n $body: 4\n },\n output: {\n '/api/resource_1' => 'result',\n '/api/resource_2' => {body: 4, status: 301}\n }\n },\n 'disallows using raw keys with meta-fields' => {\n input: %q{\n /api:\n $body: 'hello'\n raw: 1\n },\n output: Embassy::Parser::UnexpectedTypeError\n },\n 'can return an object as a body' => {\n input: %q{\n /api:\n $body:\n a: 1\n b: 2\n c: 3\n },\n output: {\n '/api' => {'a' => 1, 'b' => 2, 'c' => 3}\n }\n },\n 'can return an array as body' => {\n input: %q{\n /api:\n $body:\n - 1\n - 2\n - 3\n },\n output: {\n '/api' => [1, 2, 3]\n }\n }\n }\nend",
"def assert_added_route_for(name)\n assert_generated_file(\"config/routes.rb\") do |body|\n assert_match /map.resources :#{name.to_s.underscore}/, body,\n \"should add route for :#{name.to_s.underscore}\"\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def add_resource_route( resource, info)\n\n namespaces = resource.split('::')\n resource_name = namespaces.pop\n h = @resources_routes\n namespaces.each do |namespace|\n h[namespace] ||= {}\n h = h[namespace]\n end\n h[resource_name] ||= []\n h[resource_name].push(info)\n\n# @resources_routes[resource.to_sym] ||= []\n# @resources_routes[resource.to_sym].push( info )\n end",
"def parse_id(id)\n id.split('/')\n end",
"def show\n # going to get a single post by ID\n @post = Post.find(params[:id]) #dynamic route matcher\n end",
"def add_swagger_route http_method, path, opts = {}\n full_path = path.gsub(/{(.*?)}/, ':\\1')\n match full_path, to: \"#{opts.fetch(:controller_name)}##{opts[:action_name]}\", via: http_method\n end",
"def get(route)\n pattern = route.gsub(/:(\\w+)/, '(?<\\1>[^\\\\/]+)')\n puts pattern # => /hello/(?<name>[^\\/]+)\n end",
"def to_param\n \"#{id} #{name}\".parameterize\n end",
"def to_param\n \"#{id} #{name}\".parameterize\n end",
"def normalize_route_configuration(uri_path, position, configuration_data)\n uri_path = uri_path[1..-1] if uri_path.start_with?('/')\n uri_path = uri_path.chomp('/').split('/')\n recursive_traverse_uri(regex_to_data = {}, position, uri_path, configuration_data)\n end",
"def sanitize_opts_of_endpoint_data(opts, path)\n opts.delete_if {|k,v| path.match(/:#{k}(\\/|$)/) }\n end",
"def test_format_path_with_illegal_literals\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('info')\n assert_equal(['/resource/foobar%25', nil],\n link.format_path(['foobar%']))\n end",
"def load_yaml(file)\n require 'yaml'\n tokens = YAML.load_file(file)\n tokens.each do |token, category|\n @db[token] = category\n end\n end",
"def api \n api = { }\n \n param_regex = Regexp.new '\\(\\[\\^\\\\\\\\\\/\\?\\#\\]\\+\\)'\n Nagira.routes.keys.each do |method|\n api[method] ||= []\n Nagira.routes[method].each do |r|\n path = r[0].inspect[3..-3]\n r[1].each do |parm|\n path.sub!(param_regex,\":#{parm}\")\n end\n path.gsub!('\\\\','')\n api[method] << path unless path.empty? \n end\n end\n api\n end",
"def normalize_posts_meta(hash)\n hash[\"posts\"] ||= {}\n hash[\"posts\"][\"path\"] ||= config[\"path\"]\n hash[\"posts\"][\"categories\"] ||= config[\"categories\"]\n config[\"path\"] ||= hash[\"posts\"][\"path\"]\n hash\n end",
"def gather_endpoints_to_check\n Rails.application.routes.routes.map do |route|\n verb = route.verb.downcase.to_sym\n example_path = route.path.spec\n .to_s.gsub('(.:format)', '')\n .gsub(/:([^\\/]+)/,'SOME_PLACEHOLDER_PARAM')\n .gsub('*path', 'SOME_PLACEHOLDER_PATH')\n .gsub('*filename','SOME_PLACEHOLDER_FILENAME')\n next unless verb.present?\n [verb, example_path]\n end.compact\n end",
"def lookup_url\n @config.lookup_opts[:url].sub('$:id$', @params[:id].to_s)\n end",
"def url_placeholders; end",
"def url_placeholders; end",
"def url_options_for_navigation_entry(entry)\n {\n controller: entry[\"controller\"],\n action: entry[\"action\"],\n only_path: true,\n params: entry[\"params\"]\n }.delete_if { |_k, v| v.nil? }\n end",
"def friendly_id_config; end",
"def resources_for http_verb, path\n param_vals = []\n curr_node = @routes_tree[http_verb.to_s.downcase]\n return unless curr_node\n\n path.scan(%r{/([^/]+|$)}) do |(key)|\n next if key.empty?\n\n if curr_node[key]\n curr_node = curr_node[key]\n\n elsif curr_node[\"%s\"]\n param_vals << key\n curr_node = curr_node[\"%s\"]\n\n else\n return\n end\n end\n\n return unless curr_node.value\n rsc = curr_node.value.dup\n\n rsc[-1] = param_vals.empty? ?\n Hash.new :\n rsc[-1].inject({}){|h, name| h[name] = param_vals.shift; h}\n\n rsc\n end",
"def load!(file)\n hash = {}\n YAML.load_file(file).each do |k, v|\n hash[Pathname(k)] = v.map{|vv| Pathname(vv) }\n end\n replace(hash)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @url_pattern = args[:url_pattern] if args.key?(:url_pattern)\n end",
"def parse_where_param\n string = params[:where]\n # => \"((c1)~or~(c2))~and~((d1)~or~(d2))\"\n yaml = '[' + string.gsub('(', '[').gsub(')', ']').gsub('~', ', ').gsub(':',':') + ']'\n # => \"[[[c1], or, [c2]], and, [[d1], or, [d2]]]\"\n array = YAML.load yaml\n # => [[[\"c1\"], \"or\", [\"c2\"]], \"and\", [[\"d1\"], \"or\", [\"d2\"]]]\n array = array.first while array.first.is_a?(Array) and array.size == 1\n # in case top level is nested too deep\n array\n end",
"def to_param\n slug # or \"#{id}-#{name}\".parameterize\n end",
"def parse_task_ids full_document\n full_document.gsub(/%task(\\d+)/) do\n link_to \"task ##{$1}\", task_path($1)\n end\n end",
"def test_dvd_routings\n assert_routing '/dvds', :controller => 'dvds', :action => 'index'\n assert_routing '/dvds/index/1', :controller => 'dvds', :action => 'index', :id => '1'\n assert true\n end",
"def routes(context={})\n \n routes = [{:path => '/admin/system',\n :parent_path => '/admin',\n :regular_expression => /^\\/admin\\/system/, \n :title => 'Sistema', \n :description => 'Reads the log messages',\n :fit => 1,\n :module => :system },\n {:path => '/admin/logger',\n :parent_path => '/admin/system',\n :regular_expression => /^\\/admin\\/logger/, \n :title => 'Trazas', \n :description => 'Reads the log messages',\n :fit => 1,\n :module => :system },\n {:path => '/logger-config',\n :regular_expression => /^\\/admin\\/logger-config/, \n :title => 'Logger configuration', \n :description => 'Configure the logger',\n :fit => 1,\n :module => :system }, \n {:path => '/business-events',\n :regular_expression => /^\\/admin\\/business-events/, \n :title => 'Business events',\n :description => 'Manage the business events.',\n :fit => 1,\n :module => :system }]\n \n end",
"def anchored_routes; end",
"def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end",
"def route_sets; end",
"def convert_to_path_params_segments(some_path)\n segs = strip_bookend_slashes(some_path).split('/')\n \n return segs.map{ |seg|\n if ms = seg.match(/(?<=:)\\w+/)\n ms[0].to_sym\n else\n seg\n end\n }\n end",
"def normalize_params(h = nil)\n h = params unless h.is_a?(Hash)\n hn = {}\n re = /.+_id$/i\n \n h.each do |hk, hv|\n case hv\n when ActionController::Parameters\n hv = normalize_params(hv.to_h)\n when Hash\n hv = normalize_params(hv)\n end\n\n hn[hk.to_sym] = hv\n shk = hk.to_s\n hn[\"_#{shk}\".to_sym] = (hv.is_a?(String) ? hv.dup : hv) if (shk == 'id') || (shk =~ re)\n end\n\n hn\n end",
"def id\n slug\n end",
"def test_routes\n assert_routing(\n { :path => \"/api/capabilities\", :method => :get },\n { :controller => \"api\", :action => \"capabilities\" }\n )\n assert_recognizes(\n { :controller => \"api\", :action => \"capabilities\" },\n { :path => \"/api/0.6/capabilities\", :method => :get }\n )\n assert_routing(\n { :path => \"/api/0.6/permissions\", :method => :get },\n { :controller => \"api\", :action => \"permissions\" }\n )\n assert_routing(\n { :path => \"/api/0.6/map\", :method => :get },\n { :controller => \"api\", :action => \"map\" }\n )\n assert_routing(\n { :path => \"/api/0.6/trackpoints\", :method => :get },\n { :controller => \"api\", :action => \"trackpoints\" }\n )\n assert_routing(\n { :path => \"/api/0.6/changes\", :method => :get },\n { :controller => \"api\", :action => \"changes\" }\n )\n end",
"def sanitize_path_parts(options = {})\n if (options[:action] && options[:action].match(/^\\d*$/))\n id = options[:action]\n action = options[:id]\n options[:action] = action\n options[:id] = id\n end\n options[:action] ||= (options[:id] ? \"show\" : \"index\")\n options\n end",
"def assert_routing_for_resources(controller, skip=[], nesting=[], collection={}, member={}, resource=nil)\n\t\troutes = [\n\t\t\t[\"index\",'',{},:get], [\"new\",'/new',{},:get], [\"create\",'',{},:post],\n\t\t\t[\"show\",'/1',{:id=>'1'},:get], [\"edit\",'/1/edit',{:id=>'1'},:get],\n\t\t\t[\"update\",'/1',{:id=>'1'},:put], [\"destroy\",'/1',{:id=>'1'},:delete]\n\t\t\t]\n\t\tcollection.each_pair do |k,v|\n\t\t\troutes << [k.to_s, \"/#{k}\", {}, v]\n\t\tend\n\t\tmember.each_pair do |k,v|\n\t\t\troutes << [k.to_s, \"/1/#{k}\", {:id=>'1'}, v]\n\t\tend\n\t\tcheck_resource_routing(controller, routes, skip, nesting, resource)\n\tend",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def normalize_link_id(id); end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def urls\n keys.map{ |k| k[/^#{prefix}(.*)/, 1] }\n end",
"def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end",
"def id\n \n id = path_info.split(\"/\")[1]\n\n # Fix for /path/id.with.dot like /person/full.name - where format is \"json\" (derived from either Accept or Content-Type)\n if [\"html\", \"json\", \"xml\"].include? format\n if not id.nil? # for POST id is null\n id = id.gsub(/\\.(html|json|xml)$/, \"\")\n end\n \n else\n \n # Otherwise, remove trailing .json or .xml\n if id =~ /[.]/\n id = id.split(\".\")\n id.pop\n id = id.join(\".\")\n end\n \n end\n \n if id == [] or id.nil?\n id == \"\"\n end\n \n id\n \n end",
"def remove_from_index_path(klass, index, key_or_id, value_or_id = nil, id = nil)\n if id\n \"/index/#{klass}/%{index}/%{key}/%{value}/%{id}\" % {:index => index, :key => key_or_id, :value => value_or_id, :id => get_id(id)}\n elsif value_or_id\n \"/index/#{klass}/%{index}/%{key}/%{id}\" % {:index => index, :key => key_or_id, :id => get_id(value_or_id)}\n else\n \"/index/#{klass}/%{index}/%{id}\" % {:index => index, :id => get_id(key_or_id)}\n end\n end",
"def parse_router_id(config)\n value = config.scan(/router-id ([^\\s]+)/).first\n value = value ? value[0] : nil\n { router_id: value }\n end",
"def transform\n params.transform_keys! { |key| key.tr('-', '_') }\n end",
"def parse_categories_structure(category_id = nil)\n super category_id, { product_link: '.productsArea .productArea .productDetail a',\n next_page_link: '.productsArea .tsk-pageview .next a' }\n end",
"def find_layout(layout, keys, formats); end",
"def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def children_params\n klass_id = self.class.name.split('::').last.downcase + '_id'\n route_params.merge(klass_id.to_sym => id).reject { |k, v| k == :id }\n end",
"def routes\n [@name.downcase]\n end",
"def normalize_render(category, payload)\n if path = payload[:identifier]\n title = relative_path(path)\n path = nil if path == title\n end\n\n [ category, title, nil ]\n end",
"def load_yaml(args = {})\n file = File.read(args[:file] || CMUX_YAML)\n yaml = YAML.load(file)\n args[:key] ? yaml[args[:key]] : yaml\n rescue Psych::SyntaxError\n message = \"Make sure you've written #{file} in YAML Simple Mapping.\" \\\n ' Please check README.'\n raise message.red\n end",
"def replace_placeholder(placeholder)\n @mappings[extract_categories(placeholder).first]\n end",
"def parse_routes!\n allowed_routes.each do |route|\n if (endpoint = endpoints.find_from_route(route))\n endpoint.merge_http_methods!(route[:http_methods])\n else\n controller = controllers.find_or_create_from_route(route)\n endpoint = endpoints.create_from_route(route, controller)\n\n controller.add_endpoint(endpoint)\n end\n end\n end",
"def descriptive_url(item, locale = :en)\n parts = [item.name.parameterize, item.id]\n parts.reject(&:blank?).join('-')\n end",
"def route(args)\n routes=Routes.instance\n (cmd, pattern, dest, opts)=args\n\n d=URI::parse(dest)\n\n case cmd # route [add|remove]\n when :add\n routes.add(pattern, d, opts)\n when :remove\n routes.remove(pattern, d, opts)\n end\nend",
"def idify(*ary)\n \"#{ary[0]}:/#{ary[1]}/#{ary[2]}#{ary[3]}\"\n end",
"def populate(file, klass)\n yml = YAML.load_file(file)\n yml.each_pair do |key, values|\n obj = klass.new\n values.each_pair do |k, val|\n obj.send((\"#{k}\" + \"=\").to_sym, val) unless val == \"id\"\n end\n obj.save\n end\nend",
"def to_param\n\t \"#{id} #{name}\".parameterize\n\tend",
"def extract_key_from_link\n self.resource_id = original_link.to_i\n end",
"def parse(args)\n opts = @parser.parse(args)\n\n opts[:tail] = @parser.tail\n opts[:tail] << 'id:.' if @parser.tail.empty?\n\n opts\nend",
"def route_path(item)\n # in-memory items have no file\n return item.identifier + \"index.html\" if item[:content_filename].nil?\n\n url = item[:content_filename].gsub(/^content/, '')\n\n # determine output extension\n extname = '.' + item[:extension].split('.').last\n outext = '.haml'\n if url.match(/(\\.[a-zA-Z0-9]+){2}$/) # => *.html.erb, *.html.md ...\n outext = '' # remove 2nd extension\n elsif extname == \".sass\" || extname == \".scss\"\n outext = '.css'\n else\n outext = '.html'\n end\n url.gsub!(extname, outext)\n\n url\nend",
"def add_admin_routes\n ['sidebar','users','pages','documents','settings'].each do |file|\n template \"config/admin/#{file}.yml\", \"config/admin/#{file}.yml\"\n end\n end",
"def route_path(item)\n # in-memory items have not file\n return item.identifier + \"index.html\" if item[:content_filename].nil?\n\n url = item[:content_filename].gsub(/^content/, '')\n\n # determine output extension\n extname = '.' + item[:extension].split('.').last\n outext = '.haml'\n if url.match(/(\\.[a-zA-Z0-9]+){2}$/) # => *.html.erb, *.html.md ...\n outext = '' # remove 2nd extension\n elsif extname == \".sass\"\n outext = '.css'\n else\n outext = '.html'\n end\n url.gsub!(extname, outext)\n\n if url.include?('-')\n url = url.split('-').join('/') # /2010/01/01-some_title.html -> /2010/01/01/some_title.html\n end\n\n url\nend",
"def key_substitutor(config_key, value)\n lambda do |**args|\n result = []\n value.each do |line|\n replace = line.scan(/<(\\S+)>/).flatten.map(&:to_sym)\n replace.each do |item|\n line = line.sub(\"<#{item}>\", args[item].to_s) if args.key?(item)\n end\n result.push(line) unless /<\\S+>/.match(line)\n end\n if result.empty?\n fail ArgumentError,\n \"Arguments given to #{config_key} yield empty result\"\n end\n preprocess_value(result)\n end\n end",
"def parseSlashDesc(desc)\n hash = Hash.new\n desc.split(\"/\").each do |entry|\n key,value = entry.split(\"=\",2)\n if !value.nil?\n value.gsub!(\"\\\"\",\"\")\n hash[key] = value.chomp(\" \")\n end\n end\n hash\nend",
"def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end",
"def edit\n Log.add_info(request, params.inspect)\n\n @yaml = ApplicationHelper.get_config_yaml\n end",
"def parse_yaml(path)\n require 'yaml'\n\n str = Nitro::Template.new.render(File.read(path))\n\n if yaml = YAML::load(str)\n for name, data in yaml\n self[name] = instantiate(data)\n end\n end\n\n # sort the objects.\n\n str.scan(/^(\\w*?):$/).each do |key|\n @objects << self[key.to_s]\n end\n end",
"def missing_keys(route, parts); end",
"def make_urls(pretty_hash)\n pretty_hash.map do |hash|\n URLS[:akab].sub('#property_id#', hash[:property_id].to_s) \\\n .sub('#product_version#', hash[:production_version].to_s)\n end\n end",
"def parse_pipelines_name_id(json_resp)\n configs = JSON.parse(json_resp)\n configs.each do |config|\n puts \"#{config['name']}:#{config['id']}\"\n end\n end",
"def collection_id\n super.map { |url| URI(url).path.sub('/', '') }\n end",
"def route_descriptor_ar(routeset)\n routeset.routes.collect do |route|\n name = routeset.named_routes.routes.index(route).to_s\n verb = route.conditions[:method].to_s.upcase\n path = route.segments.inject(\"\") { |str,s| str << s.to_s }\n path.chop! if path.length > 1\n { :name=>name, :verb=>verb, :path=>path }.merge(route.requirements)\n end ; end",
"def test_format_path\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('info')\n assert_equal(['/resource/44724831-bf66-4bc2-865f-e2c4c2b14c78', nil],\n link.format_path(['44724831-bf66-4bc2-865f-e2c4c2b14c78']))\n end"
] | [
"0.5212154",
"0.51716906",
"0.50567716",
"0.50140834",
"0.49227315",
"0.48592606",
"0.48545387",
"0.48118857",
"0.47876295",
"0.47670358",
"0.47604144",
"0.47178108",
"0.47089228",
"0.46956918",
"0.4693937",
"0.4648021",
"0.4606323",
"0.45692265",
"0.45577756",
"0.4557704",
"0.45416263",
"0.4537729",
"0.45195994",
"0.44965193",
"0.4489379",
"0.44807622",
"0.44597813",
"0.44422957",
"0.4437507",
"0.44291648",
"0.44290602",
"0.44290602",
"0.44233605",
"0.44205236",
"0.44199",
"0.44031256",
"0.44005215",
"0.43949658",
"0.4392718",
"0.43897668",
"0.43867314",
"0.43867314",
"0.4373219",
"0.4362287",
"0.4359568",
"0.43509158",
"0.43336195",
"0.433332",
"0.4327017",
"0.43212286",
"0.4311332",
"0.43108943",
"0.43097585",
"0.42996815",
"0.4295142",
"0.42854568",
"0.42837647",
"0.42828095",
"0.4278647",
"0.42730123",
"0.42695943",
"0.4258441",
"0.425594",
"0.42523786",
"0.42468813",
"0.42459655",
"0.42455867",
"0.42451736",
"0.42425528",
"0.4238102",
"0.42372832",
"0.42353913",
"0.42316362",
"0.42304713",
"0.4229359",
"0.42226493",
"0.4219034",
"0.4217662",
"0.42155272",
"0.42144895",
"0.42104587",
"0.42091084",
"0.4207302",
"0.42066005",
"0.42052886",
"0.42009237",
"0.42005518",
"0.41987827",
"0.41981044",
"0.41968167",
"0.41935408",
"0.41913128",
"0.419103",
"0.41899073",
"0.41885984",
"0.41885394",
"0.41870028",
"0.41808176",
"0.4178423",
"0.41779673"
] | 0.5207661 | 1 |
Overriding the default render method because we need to use the action variables to render the liquid template. This had to be done after the action and before the render. | def render(*args)
load_metas_for_current_slug
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_with_liquid?; end",
"def render_with_liquid?; end",
"def render_liquid(content, payload, info, path); end",
"def render\n Log.dev(\"Action: #{self}\")\n stack do\n if should_cache?\n # Ignore cache if there is flash session data as the response probably\n # expects to include it, making it unique for this user and request.\n if Global.no_cache_flash && !Current.session.flash.empty?\n Log.debug(\"Action caching ignored as session flash data is present.\")\n uncached_render\n else\n cached_render\n end\n else\n uncached_render\n end\n end\n end",
"def render(*args,&block)\n\t\toptions = args.dup.extract_options!\n\t\t@rendered_action = options[:action]\n\t\tsuper\n\tend",
"def render_liquid(content, payload, info, path = T.unsafe(nil)); end",
"def liquid_renderer; end",
"def render_template(context, options); end",
"def render_variable(context); end",
"def render_template(view, template, layout_name, locals); end",
"def render_liquid(content, payload, info, path)\n renderer.render_liquid(content, payload, info, path)\n end",
"def _render_template(options); end",
"def _render_template(options); end",
"def rendered; end",
"def render\n end",
"def render(*args)\n super *args\n end",
"def render(page)\n rails_render(partial: page.tr(\"-\", \"_\"), layout: false) ||\n rails_render(action: page.tr(\"-\", \"_\"), layout: false) ||\n super.html_safe\n end",
"def render(context, options); end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render_custom(template, params)\n if (template != nil)\n blank = Liquid::Template.parse(template)\n blank.render(params)\n end\n end",
"def render\n end",
"def render\n end",
"def render\n end",
"def render(args={})\n return if @redirect\n @render_nothing = args[:nothing] # TODO hack to block automatic method templates\n json = args[:json]\n action = args[:action]\n html = args[:html]\n content = args[:content_type]\n partial = args[:partial]\n # xxx hack to let me fake scope to other controllers without loading\n temp = @handlerpath\n @handlerpath = args[:controller] if args[:controller]\n @content_type = content if content\n @current_layout = args[:layout] if args[:layout]\n write html if html\n @content_type = 'text/plain' if !content && json\n write json if json\n @render_nothing = true if json\n @rendered_template = true if json\n @current_layout = nil if json\n @rendered_template = true if action\n render_rhtml [\"#{action}.rhtml\"] if action\n # TODO hack end to return scope to current controller\n @handlerpath = temp\n end",
"def show\n redirect_to action: \"index\"\n\n # ask shopify to render like native liquid page\n render content_type: 'application/liquid'\n end",
"def view(page, *)\n rails_render(action: page.tr(\"-\", \"_\"), layout: true) ||\n rails_render(html: super.html_safe, layout: true)\n end",
"def render\n layout = File.read \"#{site.root}/_layouts/#{@layout}.html\"\n @output = Liquid::Template.parse(layout).render('post'=>self) \n end",
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render\n end",
"def render\n\n end",
"def render(*args)\n possible_actions = %w(\n create update destroy join mark_as_read block unblock\n publish pin send_to_bottom call open display_results\n )\n args = ['show'] if args.empty? && possible_actions.include?(action_name)\n super\n end",
"def render_view(action_name, variables = {})\n render_custom(action_name, variables) do |action|\n action.layout = nil\n action.method = nil\n yield(action) if block_given?\n end\n end",
"def render\n # To be implemented.\n end",
"def render( render_state )\n\t\treturn nil\n\tend",
"def render(*args, &block); end",
"def rendered_templates; end",
"def render(options = nil, extra_options = {}, &block)\n if params[:format] == 'xml' # dump the view state as XML\n put_xml @view_state\n else\n super options\n end\n end",
"def render(*args) \n return '' if @root.nil? \n \n context = case args.first\n when Liquor::Context\n args.first\n when Hash\n Context.new([args.first, assigns], instance_assigns, registers, @rethrow_errors)\n when nil\n Context.new(assigns, instance_assigns, registers, @rethrow_errors)\n else\n raise ArgumentError, \"Expect Hash or Liquor::Context as parameter\"\n end\n \n options = nil\n case args.last\n when Hash\n options = args.last\n \n if options[:registers].is_a?(Hash)\n self.registers.merge!(options[:registers]) \n end\n\n if options[:filters]\n context.add_filters(options[:filters])\n end\n \n if options[:layout]\n raise ArgumentError, \"Expected Liquor::Template as layout argument\" unless options[:layout].is_a? Liquor::Template\n end \n \n when Module\n context.add_filters(args.last) \n when Array\n context.add_filters(args.last) \n end\n \n begin \n # render the nodelist.\n # for performance reasons we get a array back here. join will make a string out of it\n res = @root.render(context).join\n \n if options && options[:layout]\n content_for_assigns = (context.has_key?(\"content_for\") ? context[\"content_for\"] : {})\n content_for_assigns = content_for_assigns.merge({ \"_rendered_template_\" => res })\n \n case args.first\n when Liquor::Context\n args.first[\"content_for\"] = content_for_assigns\n when Hash\n args.first.merge!({ \"content_for\" => content_for_assigns })\n end \n \n layout_template = args.last.delete(:layout)\n \n # Here we execute render method of the Liquor::Template object (we execute _this_ method)\n # It is not the @root.render method. It is a result of the @root.render(context).join\n # so we don't need to call join here.\n res = layout_template.render(*args)\n end\n \n res\n ensure\n @errors = context.errors\n end\n end",
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def default_render(*args)\n return super unless request.format.json?\n\n @simple_json_template = simple_renderer.renderer(template_name(action_name))\n if @simple_json_template\n render(*args)\n else\n super\n end\n end",
"def process_default_render exp\n process_layout\n process_template template_name, nil\n end",
"def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end",
"def render\n rendered_content = preprocess_template(event_template)\n .render_with(\n template_data.merge({\n event_reminder: reminder_form\n }))\n SiteTemplate.first.render_with({ content: rendered_content,\n head_assets: _head_assets,\n body_assets: script_id + _body_assets})\n end",
"def render r\n end",
"def render( * )\n\t\tnil\n\tend",
"def render( * )\n\t\tnil\n\tend",
"def render(action = nil, options = {}, &blk)\n present(@page) unless admin? or @meta.present?\n super\n end",
"def render()\n # WARNING! NO NEED TO UNDERSTAND THIS\n self.action = calling_method = caller[0].split(\"`\").pop.gsub(\"'\", \"\")\n template = File.read(view_filename)\n eruby = Erubis::Eruby.new(template)\n eruby.result(binding())\n end",
"def render( template, scope )\n\t\treturn ''\n\tend",
"def render_with_filters\n render action: :formatted_xml_erb\n end",
"def show\n render @current_template\n end",
"def rendered=(_arg0); end",
"def render(identifier, other_assigns={}, &block)\n # Find layout\n layout = @site.layouts.find { |l| l.identifier == identifier.cleaned_identifier }\n raise Nanoc3::Errors::UnknownLayout.new(identifier.cleaned_identifier) if layout.nil?\n\n # Capture content, if any\n captured_content = block_given? ? capture(&block) : nil\n\n # Get assigns\n assigns = {\n :content => captured_content,\n :item => @item,\n :item_rep => @item_rep,\n :items => @items,\n :layout => layout,\n :layouts => @layouts,\n :config => @config,\n :site => @site\n }.merge(other_assigns)\n\n # Get filter name\n filter_name, filter_args = @site.compiler.filter_for_layout(layout)\n raise Nanoc3::Errors::CannotDetermineFilter.new(layout.identifier) if filter_name.nil?\n\n # Get filter class\n filter_class = Nanoc3::Filter.named(filter_name)\n raise Nanoc3::Errors::UnknownFilter.new(filter_name) if filter_class.nil?\n\n # Create filter\n filter = filter_class.new(assigns)\n\n # Layout\n @site.compiler.stack.push(layout)\n result = filter.run(layout.raw_content, filter_args)\n @site.compiler.stack.pop\n\n # Append to erbout if we have a block\n if block_given?\n erbout = eval('_erbout', block.binding)\n erbout << result\n end\n\n # Done\n result\n end",
"def render_edit_field_partial_with_action(record_type, field_name, locals)\n partial = find_edit_field_partial(record_type, field_name)\n render partial, locals.merge(key: field_name)\n end",
"def render(*args); end",
"def render(*args); end",
"def render\n content\n end",
"def render\n content\n end",
"def render\n content\n end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil)); end",
"def render\n raise NotImplementedError\n end",
"def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end",
"def render\n content\n end",
"def render(*args,&blk)\n opts = (Hash === args.last) ? args.pop : {}\n \n action = opts[:action] || params[:action]\n opts[:layout] ||= _layout \n \n choose_template_format(Merb.available_mime_types, opts)\n \n # Handles the case where render is called with an object\n if obj = args.first || opts[:obj]\n # Check for a template\n unless find_template({:action => action}.merge(opts))\n fmt = content_type\n if transform_method = Merb.mime_transform_method(fmt)\n set_response_headers fmt\n transform_args = provided_format_arguments_for(fmt)\n return case transform_args\n when Hash then obj.send(transform_method, transform_args)\n when Array then obj.send(transform_method, *transform_args)\n when Proc then\n case transform_args.arity\n when 3 then transform_args.call(obj, self, transform_method)\n when 2 then transform_args.call(obj, self)\n when 1 then transform_args.call(obj)\n else transform_args.call\n end\n else obj.send(transform_method)\n end\n end \n end\n end \n \n case\n when status = opts[:nothing]\n return render_nothing(status)\n \n when opts[:inline]\n text = opts.delete(:inline)\n return render_inline(text, opts)\n else \n set_response_headers @_template_format\n \n case @_format_value\n when String\n return @_format_value\n when Symbol\n if !Merb.available_mime_types.keys.include?(@_format_value) # render :js => \"Some js value\"\n template = find_template(:action => @_format_value)\n else\n if opts[@_format_value] == @_format_value # An edge case that lives in the specs\n # says that a render :js => :js should be catered for\n template = find_template(:action => @_format_value)\n else\n # when called from within an action as plain render within a respond_to block\n template = find_template(opts.merge( :action => action ))\n end\n end\n else\n if template = opts[:template]\n # render :template => \"this_template\"\n template = find_template( :template => template)\n else\n # a plain action render\n # def index; render; end\n template = find_template(:action => action)\n end\n end\n end\n \n unless template\n raise TemplateNotFound, \"No template matched at #{unmatched}\"\n end\n self.template ||= File.basename(template)\n\n engine = Template.engine_for(template)\n options = {\n :file => template,\n :view_context => (opts[:clean_context] ? clean_view_context(engine) : cached_view_context(engine)),\n :opts => opts\n }\n content = engine.transform(options)\n if engine.exempt_from_layout? || opts[:layout] == :none || [:js].include?(@_template_format)\n content \n else\n wrap_layout(content, opts)\n end\n end",
"def render_action(attrs)\n controller_name = attrs[:controller] || self.controller_class.controller_name\n action_name = attrs[:action]\n @controller.action_name = action_name\n prepare_data\n self.instance_variables.collect{|v| @assigns[v[1..-1]] = self.instance_eval(\"#{v}\")}\n render_opts = {:file => \"#{controller_name}/#{action_name}\"}\n render_opts[:layout] = \"layouts/\" + (attrs[:layout] || 'application')\n\n view_html = @view.render(render_opts)\n set_response_text(view_html)\n end",
"def prepare_rendermode_for_action\n \n $render_translation_link=false\n \n if cookies[\"is_translating\"] == 'true'\n login_from_cookie\n if logged_in? && current_user.can_translate?\n $render_translation_link=true\n \n end\n \n end\n Rengine::Blurb.use_cache=!$render_translation_link\n\n if $render_translation_link\n $render_mode=:force_render\n end\n\n if params[:render_mode]\n render_base.render_mode_override =params[:render_mode].to_sym\n else\n render_base.render_mode_override=nil\n end\n\n @render_preruntime=(\"true\"==params[:render_preruntime])\n \n \n\n\n end",
"def __ag_render_a_action(key, template, options, other, &block)\n _ag_render_without_silverlight(key, template, options, other, &block)\n end",
"def render(*args)\n return '' if @root.nil?\n\n context = case args.first\n when Liquid::Context\n c = args.shift\n\n if @rethrow_errors\n c.exception_renderer = Liquid::RAISE_EXCEPTION_LAMBDA\n end\n\n c\n when Liquid::Drop\n drop = args.shift\n drop.context = Context.new([drop, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)\n when Hash\n Context.new([args.shift, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)\n when nil\n Context.new(assigns, instance_assigns, registers, @rethrow_errors, @resource_limits)\n else\n raise ArgumentError, \"Expected Hash or Liquid::Context as parameter\"\n end\n\n output = nil\n\n case args.last\n when Hash\n options = args.pop\n output = options[:output] if options[:output]\n static_registers = context.registers.static\n\n options[:registers]&.each do |key, register|\n static_registers[key] = register\n end\n\n apply_options_to_context(context, options)\n when Module, Array\n context.add_filters(args.pop)\n end\n\n # Retrying a render resets resource usage\n context.resource_limits.reset\n\n if @profiling && context.profiler.nil?\n @profiler = context.profiler = Liquid::Profiler.new\n end\n\n context.template_name ||= name\n\n begin\n # render the nodelist.\n @root.render_to_output_buffer(context, output || +'')\n rescue Liquid::MemoryError => e\n context.handle_error(e)\n ensure\n @errors = context.errors\n end\n end",
"def show\n render sti_template(@type, action_name)\n end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render(context)\n # Sanitize the code inside the block\n resolve_code = super.to_s.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n \n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n \n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end",
"def prepare_liquid_template(template)\n end",
"def make_render_in_view exp\n make_render exp, true\n end",
"def render\n return nil\n end",
"def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer, &block)\n end",
"def before_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def render_plain\n template_content\n end",
"def render_variable(context)\n Liquid::Template.parse(@file).render(context) if @file =~ VARIABLE_SYNTAX\n end",
"def render\n raise NotImplementedError\n end",
"def render(opts={})\n update(opts)\n render_template\n end",
"def render *args\n initialize_redux_store\n super\n end",
"def render\n ERB.new(load_resource(template)).result(bound.get_binding)\n end",
"def render(scope, locals = {})\n @_template.render(scope.dup, locals)\n end",
"def render(state, format, local_variables = {})\n view.template_format = format\n render_opts = { :file => find_template(state), :locals => local_variables }\n render_opts[:layout] = find_template(layout) if layout\n view.render(render_opts)\n end",
"def render(*args)\n if request.path_parameters['action'] == \"edit\" && params[:revision]\n model.set_to_revision(params[:revision])\n end\n super(*args)\n end",
"def render(options = {})\n template.render options\n end",
"def render_partial(context, options, &block); end",
"def liquid_block(block)\n Liquid::Template.parse(block).render(@context)\n end",
"def erb(template, options = {}, locals = {})\n template = template.to_sym\n options[:layout] = options[:layout].present? ? options[:layout] : !request.xhr?\n \n super\n end",
"def filter\n setup_instance_variables\n render 'index'\n end",
"def default\n html = @parent.render(partial: 'resources/menu', formats: [:html], locals: { parent: @parent })\n# render error messages and usage table\n html << dc_flash_messages << resources_usage\nend",
"def render(*args)\n if request.path_parameters['action'] == \"edit\" && params[:revision]\n # Change revision number if given revision is not existed and we have set last revision\n params[:revision] = model.set_to_revision(params[:revision])\n end\n super(*args)\n end",
"def to_liquid; end",
"def to_liquid; end",
"def to_liquid; end",
"def render(*args)\n path = encode_uri(*args)\n\n debug \"Rendering '#{path}'\" if $DBG\n \n @controller_class, action, query, params, @context.format = @context.dispatcher.dispatch(path)\n# @context.content_type = @context.format.content_type\n\n @context.level += 1\n old_controller_class = Controller.replace_current(@controller_class)\n \n if self.class == @controller_class \n render_action(action, params)\n else\n @controller_class.new(@context).send(:render_action, action, params)\n end\n\n Controller.replace_current(old_controller_class)\n @context.level -= 1\n end"
] | [
"0.6769935",
"0.6769935",
"0.67138946",
"0.6686915",
"0.664009",
"0.6449126",
"0.64433473",
"0.631799",
"0.6242777",
"0.6238381",
"0.61811996",
"0.61691487",
"0.61691487",
"0.6164078",
"0.6134422",
"0.6127781",
"0.61245626",
"0.6100144",
"0.606414",
"0.606414",
"0.606414",
"0.606414",
"0.606414",
"0.60591364",
"0.60553026",
"0.60553026",
"0.60553026",
"0.60282993",
"0.6027085",
"0.6018106",
"0.60024065",
"0.5976193",
"0.5959156",
"0.595198",
"0.5946186",
"0.5933348",
"0.5842342",
"0.5821714",
"0.5820081",
"0.579104",
"0.57881576",
"0.5780811",
"0.5759899",
"0.57504773",
"0.5738801",
"0.5735903",
"0.57179385",
"0.57037723",
"0.5697216",
"0.5697216",
"0.5693645",
"0.56915414",
"0.5679751",
"0.567533",
"0.5674553",
"0.5665459",
"0.56585115",
"0.565529",
"0.5655029",
"0.5655029",
"0.565401",
"0.565401",
"0.565401",
"0.5648946",
"0.56274474",
"0.56131345",
"0.5612278",
"0.5610808",
"0.56096935",
"0.5608906",
"0.5605691",
"0.56051296",
"0.5603821",
"0.55996454",
"0.5598992",
"0.5596499",
"0.55908394",
"0.55864304",
"0.557741",
"0.5565732",
"0.5558773",
"0.5556857",
"0.55563146",
"0.55427325",
"0.55405843",
"0.5527099",
"0.55212593",
"0.55199635",
"0.5519285",
"0.5517204",
"0.551479",
"0.55098474",
"0.5509177",
"0.5496494",
"0.54876727",
"0.548468",
"0.54841036",
"0.54841036",
"0.54841036",
"0.54778963"
] | 0.55553126 | 83 |
summon_captain_planet notes use .map because it returns a new array and returns that while .each prints the changes but returns the original arrya | def long_planeteer_calls(calls)# code an argument here
# Your code here
calls.any? {|x| x.chars.length>4}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summon_captain_planet(elements)\n p elements.map {|summon_elements| \"#{summon_elements}!\".capitalize}\nend",
"def summon_captain_planet(planateer_calls)\n planateer_calls.collect {|call| call.capitalize + \"!\"}\n #planateer_calls.map {|call| call.capitalize + \"!\"}\nend",
"def \n \n summon_captain_planet(planeteer_calls)\n \n planeteer_calls.map { |element| element.capitalize + \"!\" }\n \nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map do |call|\n call.capitalize + \"!\"\n end\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map do |calls|\n \"#{calls.capitalize}!\"\n # binding.pry\n end\nend",
"def summon_captain_planet(array)\n array.collect do |calls|\n \"#{calls.capitalize}!\"\n end\nend",
"def summon_captain_planet(array)\n array.collect{ |planeteer_call| planeteer_call.capitalize + \"!\"\n }\nend",
"def summon_captain_planet(calls)\n calls.map do |call|\n call.capitalize + \"!\"\n end\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |element| element.capitalize! + \"!\"}\nend",
"def summon_captain_planet(planeteer_calls) \n planeteer_calls.map do |n| \n n.capitalize << \"!\" \n end\nend",
"def summon_captain_planet(array)\n array.collect do |x|\n x.capitalize << \"!\"\n end\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect {|i| i + \"!\"}.map(&:capitalize)\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + '!' }\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + \"!\" }\n end",
"def summon_captain_planet(planeteer_calls)\n calls = [];\n planeteer_calls.collect { |call| calls.push(\"#{call.capitalize}!\")}\n return calls;\nend",
"def summon_captain_planet(planteers)\n updated = []\n planteers.each do |planteer|\n planteer = planteer.capitalize() \n updated << \"#{planteer}!\"\n end\n updated\nend",
"def summon_captain_planet( array )\n new_array = []\n array.map do |elements|\n new_elements = elements.split.map(&:capitalize).join(' ')\n new_elements = \"#{new_elements}!\"\n new_array << new_elements\n end\n new_array\nend",
"def summon_captain_planet(array)\n array.map! {|command| command.capitalize + \"!\"}\nend",
"def summon_captain_planet(planeteer_calls) # code an argument here\n # Your code here\n planeteer_calls.map! { |planeteer| planeteer.capitalize + \"!\" }\nend",
"def summon_captain_planet(elements)# code an argument here\n # Your code here\n elements.map do |element|\n element.capitalize + \"!\"\n end\nend",
"def summon_captain_planet(planeteer_calls) # Your code here\n planeteer_calls.map {|powers| powers.capitalize.concat(\"!\")}\nend",
"def summon_captain_planet(planeteer_calls)\nplaneteer_calls.map { |string| \"#{string.capitalize}!\" }\nend",
"def summon_captain_planet(planeteer_calls)\n newArray = []\n i = 0\n while i < planeteer_calls.length do\n newArray.push(planeteer_calls[i].concat(\"!\").capitalize) \n i += 1\n end\n newArray\nend",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect{|item| \"#{item.capitalize}!\" }\nend",
"def planet_list\n planet_array = []\n @planets.each_with_index do |planet, index|\n # **--->how to do without storing list in an array as a variable??\n # **--->prints whole array of hashes if not\n current_planet = \"#{index + 1}. #{planet.name}\"\n planet_array << current_planet\n end\n return planet_array\n end",
"def summon_captain_planet(array)\n newarray = []\n i = 0 \n while i < array.length\n newarray << array[i].capitalize + \"!\"\n \n i = i + 1\nend\n newarray\nend",
"def summon_captain_planet(captain_planet)\n captain_planet.collect{ |food, index| \"#{index}#{food.capitalize}!\"}\n # Your code here\nend",
"def summon_captain_planet(arr)\n arr.map {|word| word.capitalize + \"!\"}\nend",
"def planet_list\n return @planets\n end",
"def cycle_through_system\n @planets.each do|planet|\n @ranked_planets.push(planet[:name])\n end\n # Ranked numbered list of planets\n return @ranked_planets\n end",
"def all_info(the_planet_i_care_about)\n return @planets.each do |each_planet_in_my_solar_system|\n if each_planet_in_my_solar_system.name == the_planet_i_care_about\n puts each_planet_in_my_solar_system.info\n end\n end\n end",
"def triplify(array)\n \t \n \t new_array = array.map { |i| i * 3 }\n \t p new_array\n end",
"def summon_captain_planet(array)\n array.collect { |word| word.capitalize + \"!\" }\nend",
"def team_names()\n temp =[]\n game_hash.each do |location, team_data|\n #binding.pry\n temp << team_data[:team_name]\n end\n temp\nend",
"def list_planets()\n\t\tplanets_list = @planets.each_with_index.map {|planet,index|\n\t\t\t\"#{index + 1}. #{planet.name}\"}\n\t\tplanets_list.unshift(\"Planets orbiting #{@star_name}:\\n\").to_s\n\t\t\n\t\treturn planets_list \n\tend",
"def each_map_exp\n\n \tletters = [\"aaa\", \"b\", \"c\", \"d\", \"e\", \"a\", \"b\", \"h\"]\n\n\tsuperheroes = {\n\t\tsuperman: \"flying\",\n\t\tbatman: \"World's greatest butler\",\n\t\tspiderman: \"shooting web\"\n\t}\n\n\n\tputs \"\\n\\n Using .each\\n\"\n\t#---------------------------------------\n\tputs \"This is before running the block.\"\n\tp letters\n\tletters.each do |letter|\n\t\tputs letter\n\tend\n\tp letters\n\tputs \"This would be after running the block.\"\n\n\t# Running .each on the hash\n\tputs \"This is before running the block.\"\n\tp letters\n\tsuperheroes.each do |superhero, power|\n\t\tputs \"The superhero #{superhero} has a power of #{power}\"\n\tend\n\tputs \"This would be after running the block.\"\n\n\n\n# Running the .map method\n # Running .map on the array and setting it to a new array\n\tputs \"\\n\\n Using .map\\n\"\n\t#------------------------\n\tputs \"This is before running the letters.map block\"\n\tp letters\n\tnew_letters_array = letters.map do |letter|\n\t\tp letter\n\tend\n\tputs \"This is after running the letters.map block\"\n\tp new_letters_array\n\n\t# Running .map on the hash and returning an array\n\tputs \"This is before running the superhero hash .map block\"\n\tp superheroes\n\tnew_superhero_hash = superheroes.map do |superhero, power|\n\t\tp \"#{superhero}, #{power}\"\n\tend\n\tputs \"This is after running the superhero hash .map block\\n\"\n\tp new_superhero_hash\n\n\n# Running the .map! method\n # Running the destructive .map! on the array\n\tputs \"\\n\\nUsing .map!\\n\"\n\t#--------------------------\n\tp \"This is before running the letters array .map! block\"\n\tp letters\n\tletters.map! do |letter|\n\t\tp letter.next\n\tend\n\tp \"This is after running the letters array .map! block\"\n\tp letters\n\n # Running the destructive .map! on the Hash --- NO BUENO\n \tdef using_map_on_hash \n\tp \"This is before running the superhero hash .map! block\"\n\tp superheroes\n\tsuperheroes.map! do |superhero, power|\n\t\tp \"#{superhero}, #{power}\"\n\tend\n\tp \"This is after running the superhero hash .map! block\"\n\tend\nend",
"def solarsystem_sentence_return\n sentences = []\n @array_of_planets.each do |planets|\n sentences << planets.each_planet_return\n end\n return sentences\n end",
"def list_planets\n puts \"Planets orbiting #{star_name}:\"\n\n @planets.each_with_index do |planet, i|\n @list_of_planets << \"#{i+1}. #{planet.name}\"\n end\n return @list_of_planets\n end",
"def players\n # Build two arrays of players\n cur_players = teams.map do |team|\n team.wattball_players\n end\n\n # Combine the arrays\n cur_players.flatten! \n end",
"def map &block\n @legs.map &block\n end",
"def list_planets\n planet_list = \"Planets orbiting #{ @star_name }\\n\"\n @planets.length.times do |add|\n planet_list += \"#{ add + 1 }. #{ @planets[add].name }\\n\"\n end\n\n return planet_list\n end",
"def planets\n # go through my colonies\n self.colonies.map do |my_colony|\n # get the information about each planet the colony is on\n my_colony.planet\n end\n end",
"def chasing_squirrels(dogs)\n dogs.map! do |individual_dog|\n individual_dog[:position] += 5\n individual_dog\n end\n return dogs\nend",
"def bond_movies(array)\n #the variable will be a new array of all the bond movie titles in the movie data array\n the_movies = array.map {|movie| movie[:title]}\n #outputs only the titles of the movies\n puts the_movies\nend",
"def return_planets\n planet_list = \"\"\n @planets.each do |planet|\n planet_list << \"#{@planets.index(planet) + 1}. #{planet.name} \\n\"\n end\n return planet_list\n end",
"def player_numbers(team_name)\n jersey_numbers = Array.new\n\n if !game_hash.keys.include?(:team_name)\n game_hash.each do |location, team_info|\n if team_info.keys.include?(:team_name)\n team_info.each do |attribute, quanity|\n if quanity == team_name\n team_info.each do |attribute, quanity|\n if attribute == :players\n # binding.pry\n quanity.each do |name, stats|\n if name.length > 0\n # binding.pry\n stats.each do |stat, stat_quanity|\n if stat == :number\n # binding.pry\n jersey_numbers << stat_quanity\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\nputs jersey_numbers\nreturn jersey_numbers\nend",
"def map(arr) # creating our own map method\n\tnewArr = [] # declaring an empty array to push our results inside\n\tarr.each do |i| # run the block of code to iterate inside each elements in an array\n\t\tnewArr << yield(i) # push the modified elements inside our newArr []\n\tend\n\tnewArr\nend",
"def all_planet_info\n list_string = \"\"\n @planets.each_with_index do |planet, i|\n list_string << \"#{i+1}.\\n#{planet.planet_info}\\n\"\n end\n return list_string\n end",
"def team_names\n # team_array = []\n game_hash.map do |location, team_data|\n # p team_data[:team_name]\n team_data[:team_name]\n end\nend",
"def planets()\n pseed = @seed.clone\n Enumerator.new do |yielder|\n loop do\n name, new_seed = planet_name(pseed)\n yielder.yield name\n break if new_seed==@seed\n pseed = new_seed\n end\n end\n end",
"def list_planets\n list_planets = \"Planets orbiting #{star_name} \\n\"\n\n @planets.each_with_index do |planet, index|\n list_planets = \"#{list_planets}\" + \"#{index + 1}. #{planet.name}\\n\"\n end\n\n return list_planets\n end",
"def investors\n array = FundingRound.all.select {|round| round.startup == self.name}\n test1 = array.map do |name|\n name.venture_capitalist\n end\n test1.uniq #output only the unique names *takes account for duplicate funding_round ppl\n\n #longer method using .each *not recommend \n # test1 = [] #test1 is the new array that will store the return values\n # @array1.each do |name| \n # test1.push(name.venture_capitalist) #we have to push it somewhere.. since .each will not push anything for us by default... \n # end\n # test1.uniq \n end",
"def summons\n return (@pets + @monsters)\n end",
"def player_collection \n all_players = [];\n game_hash.each_pair { |h_or_a, team_info|\n team_info[:players].map { |player|\n player[:location] = h_or_a;\n player[:team_name] = game_hash[h_or_a][:team_name];\n player[:team_colors] = game_hash[h_or_a][:colors];\n all_players << player;\n }\n }\n all_players; \nend",
"def aliens\n self.populations.map do |pop|\n pop.alien\n end\n end",
"def fly\n (0..4).map { @turkey.fly }\n end",
"def return_planet_names\n planet_names = \"\"\n @solar_system.each do |planet_name|\n planet_names += planet_name.planets_name\n end\n return planet_names\n end",
"def visit\r\n self.map {|x| puts x}\r\n end",
"def each_planet_return\n return \"#{@name} is a planet in the solar system that is #{@distance_from_sun} million miles from the sun and has a year length of #{@planet_year} days.\\n\"\n end",
"def print_planets\n puts \"\\n#{@name} has #{@planets.length} planets and was formed #{@formation_year} years ago.\"\n puts \"\\nHere are the planets in the #{@name} solar system:\\n\\n\"\n @planets.each do |planet|\n puts \"#{planet.print_planet_data}\"\n end\n puts \"\\n\"\n end",
"def player_numbers(team_name)\n new_Arr = []\n game_hash.each do |place, team|\n if team_name == team[:team_name]\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n new_Arr.push(player[:number])\n # binding.pry\n end\n end\n end\n end\n end\n new_Arr\nend",
"def list_planets\n planet_list = \"Planets orbiting #{@star_name}:\"\n @planets.each_with_index do |planet, index|\n planet_list += \"\\n#{index + 1}. #{planet.name}\"\n end\n return planet_list\n end",
"def list_planets\n list = \"Planets orbiting #{@star_name}:\\n\"\n @planets.each do |planet|\n list += \"* #{planet.name}\\n\"\n end\n list += \"\\n\"\n return list\n end",
"def airports_normal\n return Array.new\n end",
"def map &block\n new_array = [] # create a new array where elements will go into\n self.each {|el| new_array << (yield el)} # for each true element in the block, shovel that element into new array\n new_array # return the new array\n end",
"def baiseball_team2 **players_based_structure_data\n players_based_structure_data.each do |player, position|\n puts \"Player name: #{player}\"\n puts \"Player position: #{position}\"\n puts \"\\n\"\n end\nend",
"def list_planets\n x = \"Planets orbitting #{@star_name}\\n\"\n z = \"\"\n z = z + x\n l = 1\n while l <= @planets.length\n y = \"#{l}. #{@planets[l-1].name}\\n\"\n z += y\n l += 1\n end\n return z\n end",
"def list_planets\n planet_list = ''\n i = 0\n @planets.each do |planet|\n i += 1\n planet_list << \"#{i}. #{planet.name.capitalize}\\n\"\n end\n planet_list\n end",
"def get_all_players\n ## Version 4.0 ##\n\n all_players = []\n\n game_hash.values.each do |team_data|\n all_players << team_data[:players]\n end\n # This pattern of going through each value and then plucking out just a single\n # piece of the data is very, very common.\n # What we are doing is what .map was built for.\n\n ## Example of .map ##\n instructors = [\n { name: 'Lyn', cats: true },\n { name: 'Princeton', cats: false },\n { name: 'Maddie', cats: true }\n ]\n # Goal, get an array that looks like this:\n # ['Lyn', 'Princeton', 'Maddie']\n # This can be accomplished by .map:\n instructor_names = instructors.map do |instructor|\n instructor[:name]\n end\n # The result of map is the data you returned in each iteration.\n # Map is very cool in that you can do more than just pick data to return.\n # You can also transform the data!\n # For example, doubling the number in this array:\n x = [1, 2, 3, 4]\n doubled_x = x.map do |num|\n num * 2\n end\n # doubled_x == [2, 4, 6, 8]\n # Or even more fun, deciding what to return based on the data you are looping over:\n meow = instructors.map do |instructor|\n if instructor[:cats]\n instructor[:cats] = \"😸\"\n else\n instructor[:cats] = \"😿\"\n end\n instructor\n end\n # meow == [{ name: \"Lyn\", cats: \"😸\" }, { name: \"Princeton\", cats: \"😿\" }, { name: \"Maddie\", cats: \"😸\" }]\n\n # Knowing how map works, we can now rewrite our .each but with a map instead\n # and get rid of the initial empty array, all_players = [], because .map\n # will now return the same resulting value:\n all_players = game_hash.values.map do |team_data|\n # We can also get rid of the shovel as we don't need to put them into an array.\n team_data[:players]\n end\n\n all_players.flatten\nend",
"def get_list_of_planets\n planets = get_space_bodies.select{|body| body[\"isPlanet\"] == true}\n end",
"def roster3 **players_with_positions\n players_with_positions.each do |player, position|\n puts \"Player: #{player}\"\n puts \"Position: #{position}\"\n puts \"\\n\"\n end\nend",
"def planet_list\n list = \"\"\n @planets.each_with_index do |planet, i|\n list += \" #{i+1}. #{planet.name}\\n\"\n end\n return list\n end",
"def villains_fought\n self.battles.map do |villain|\n villain.alter_ego\n end\n end",
"def display_planet_list\n puts \"Here are the current planets in our solar system:\"\n @all_planets.each do |planet_info|\n puts planet_info.name\n end\n end",
"def roster2 **players_with_postions\n players_with_postions.each do |player, position|\n puts \"Player: #{player}\"\n puts \"Position: #{position}\"\n end\nend",
"def update_map\n @win_flag = false\n @lose_flag = false\n @eliminate_flag = false\n @my_planets = {}\n @max_rearness = 0\n\n nil_planets_ratio = @info['holds'].select { |h| h[0].nil? }.size\n nil_planets_ratio /= @info['holds'].size.to_f\n if nil_planets_ratio > 0.618\n @aggresion = AGGRESSION_START\n puts \"Aggression: #@aggresion\"\n else\n @aggresion = AGGRESSION_MID\n end\n\n @map['planets'].each_with_index do | p, ind |\n # Check whether it is owned by me\n if @info['holds'][ind][0] == @me['seq']\n # my_planet:\n # - targets: enemy planet candidates to attack if a front line planet, or next planet of the shortest path to the nearest front line planet if a rear planet\n # - rearness: how far away from the front line, 0 for planet on the front line\n my_planet = {}\n\n # Check whether on the front line\n targets = p['neighbors'].select { |n| @info['holds'][n[0]][0] != @me['seq'] }\n if targets.size > 0 # On the front line\n my_planet[:targets] = targets\n my_planet[:rearness] = 0\n end\n\n my_neighbors = p['neighbors'].select { |n| @info['holds'][n[0]][0] == @me['seq'] }\n my_planet[:my_neighbors] = my_neighbors\n\n @my_planets[ind] = my_planet\n end\n end\n\n # Compute rearness and path of my rear planets iteratively\n my_planets = @my_planets\n left_planets = @my_planets.select { |id, p| p[:rearness].nil? }\n\n if @my_planets.empty?\n @lose_flag = true\n puts \"We lose! (planets #: #{left_planets.size} / #{@my_planets.size})\"\n return\n elsif left_planets.size == @my_planets.size\n # Check whether moving enemies exist\n moving_enemies = @info['moves'].select { |m| m[0] != @me['seq'] }\n if ! moving_enemies.empty?\n puts \"Eliminating left enemies! (planets #: #{left_planets.size} / #{@my_planets.size})\"\n @eliminate_flag = true\n moving_enemies.each do |m|\n @my_planets[m[2]][:rearness] = 0\n @my_planets[m[2]][:targets] = []\n left_planets = @my_planets.select { |id, p| p[:rearness].nil? }\n end\n else\n @win_flag = true\n puts \"We win! (planets #: #{left_planets.size} / #{@my_planets.size})\"\n return\n end\n end\n\n while ! left_planets.empty?\n left_planets.each do |id, p|\n neighbors = @map['planets'][id]['neighbors'].reject { |n| my_planets[n[0]][:rearness].nil? }\n next if neighbors.empty? # Very important! Used to be a bug!!!\n nearest_neighbor = neighbors.map { |n| [ n[0], my_planets[n[0]][:rearness] + n[1] ] }.min_by { |n| n[1] }\n @my_planets[id][:targets] = nearest_neighbor[0]\n @my_planets[id][:rearness] = nearest_neighbor[1]\n @max_rearness = [@max_rearness, nearest_neighbor[1]].max\n end\n\n my_planets = @my_planets\n left_planets = @my_planets.select { |id, p| p[:rearness].nil? }\n # puts \"# of my planets: #{left_planets.size} / #{@my_planets.size}\"\n end\n end",
"def print_list(solar_system)\n solar_system.planet_list.each_index do |i|\n print \"#{i + 1}. #{solar_system.planet_list[i]} \"\n end\nend",
"def list_planets\n i = 1\n planets_list = \"\"\n @planets.each do |planet|\n planets_list += \"#{i}. #{planet.name}\\n\"\n i += 1\n end\n return \"Planets orbiting #{@star_name}:\\n#{planets_list}\"\n end",
"def map\n raise \"Do not call me when inspecting!\"\n end",
"def add_planets(planet)\n @planets << planet\n return @planets\n end",
"def team_names \n # team_array = []\n # game_hash.each do |location, team_data|\n # team_array << team_data[:team_name]\n # end\n # team_array\n game_hash.collect do |location, team_data|\n team_data[:team_name]\n end\nend",
"def test_collect_transforms_elements_of_an_array\n array = [1, 2, 3]\n new_array = array.collect { |item| item + 10 }\n assert_equal [11, 12, 13], new_array\n\n another_array = array.map { |item| item + 10 }\n assert_equal [11, 12, 13], another_array\n end",
"def list_planets\n planet_string = \"Planets orbiting #{@star_name} \\n\"\n @planets.each_with_index do |planet, index|\n planet_string += \"#{index+1}. #{planet.name} \\n\"\n end\n return planet_string\n end",
"def map(&block)\n to_a.map(&block)\n end",
"def map(&block)\n to_a.map(&block)\n end",
"def pool_to_planet(pool)\n # Create a variable to store all new Planet s\n library_of_planets = []\n pool.each do |planet_info|\n library_of_planets << planet = Planet.new(planet_info[:name], planet_info[:diameter], planet_info[:gravity],\n planet_info[:year_length], planet_info[:distance_from_the_sun])\n end\n return library_of_planets\n end",
"def planet_information(some_planet)\n @planets.each do |planet|\n if some_planet.downcase == planet.name.downcase\n return planet.organized_planet_details\n end\n end\n end",
"def zoo\n animals.map(&:zoo).uniq\n # binding.pry\n end",
"def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end",
"def names\n planet_names = []\n @planets.each do |planet|\n planet_names << planet.name\n end\n return planet_names\n end",
"def investors\n test1 = FundingRound.all.select {|round| round.startup == self.name}.map do |name|\n name.venture_capitalist\n end\n test1.uniq\n\n #longer method using .each *not recommend \n # test1 = [] #test1 is the new array that will store the return values\n # @array1.each do |name| \n # test1.push(name.venture_capitalist) #we have to push it somewhere.. since .each will not push anything for us by default... \n # end\n # test1.uniq \n end",
"def solarsystem_list_return\n list = []\n @array_of_planets.each do |bodies|\n list << \"#{@array_of_planets.index(bodies) + 1}. #{bodies.name}\"\n end\n return list\n end",
"def output_world\n #assumes that @world is set \n data = Pattern.two_d_to_string(@world)\n data.each do |d|\n puts d\n end\n end",
"def map(arr)\n # create empty array to populate with results of called block\n arr2 = []\n # for each element in the array, run the block of code, held in yield, on it then add that element to the new array\n arr.each { |x| arr2 << yield(x) }\n # return the new array, setting the original array to these new values\n arr2\nend",
"def map(&block)\n dup.map!(&block)\n end",
"def separate_bets\n # iterate each matches\n # ap all_matches\n start_time = Time.now\n total_markets = 0\n all_matches.each do |match|\n # interate each market\n logger_trace \"@@@@@@@@@@@@#{match[:name]}@@@@@@@@@@@@@@@\"\n\n match[:markets].each do |market|\n # ap market[:bets]\n logger_trace \"==========#{market[:title]}================\"\n split_bets(market[:bets])\n # match_bets(back, lays)\n end\n end\n end_time = Time.now\n markets = all_matches.map{|t| t[:markets] }.flatten\n bets = markets.flatten.map{ |t| t[:bets] }.flatten\n # puts markets\n puts \"Total matches = #{all_matches.length}, Total Markets = #{markets.length} and Total Bets = #{bets.length} ---------------#{end_time - start_time} secs\"\n end",
"def list_of_planets\n list = []\n @planets.length.times do |index|\n list << \"#{index+1}. #{@planets[index].name}\"\n end\n return list\n end",
"def three_years_back\n @extinct_animals.map do |animal, year|\n @extinct_animals[animal] = @extinct_animals[animal] - 3\n end\n puts\n puts @extinct_animals\n puts\nend",
"def make_raptors(birds_arr)\n yield(birds_arr)\nend",
"def simbolizza\n self.map do |element|\n if element.is_a? Hash or element.is_a? Array\n element.simbolizza\n else\n element\n end\n end\n end",
"def objects\n [@player] + @map.objects\n end"
] | [
"0.7219786",
"0.6943852",
"0.69017935",
"0.6859292",
"0.6842859",
"0.68212456",
"0.68094546",
"0.68043786",
"0.6695848",
"0.6688182",
"0.6638588",
"0.6623251",
"0.66096294",
"0.6589065",
"0.655674",
"0.6556649",
"0.6554864",
"0.6512446",
"0.6475842",
"0.6453566",
"0.63496584",
"0.6263337",
"0.6162469",
"0.6119965",
"0.6114288",
"0.60975397",
"0.5972636",
"0.59422004",
"0.593478",
"0.584985",
"0.5832376",
"0.581174",
"0.57747066",
"0.5761754",
"0.57515806",
"0.57459635",
"0.57418793",
"0.5737752",
"0.57365954",
"0.5717473",
"0.5699194",
"0.5685268",
"0.56740135",
"0.56574386",
"0.56565785",
"0.5641339",
"0.55926514",
"0.5575607",
"0.5570387",
"0.55696565",
"0.5561864",
"0.55251205",
"0.5505132",
"0.54860014",
"0.5468109",
"0.54640067",
"0.5462634",
"0.54534376",
"0.54384863",
"0.5438067",
"0.5433797",
"0.5428085",
"0.5427493",
"0.5422452",
"0.54031664",
"0.5390249",
"0.5383418",
"0.5376977",
"0.5363097",
"0.5349317",
"0.53435457",
"0.53384614",
"0.5329665",
"0.53286546",
"0.5325158",
"0.53146243",
"0.53050965",
"0.5303492",
"0.53013015",
"0.5297201",
"0.52936816",
"0.52731955",
"0.5266698",
"0.5253573",
"0.5253573",
"0.52526695",
"0.52474624",
"0.5242018",
"0.5239793",
"0.5237663",
"0.5234133",
"0.52332866",
"0.5202473",
"0.5196115",
"0.5194155",
"0.5182227",
"0.51773745",
"0.5174611",
"0.51742005",
"0.51709807",
"0.5164621"
] | 0.0 | -1 |
Sjaak van den Berg | def score_throws(radiuses)
score = radiuses.map do |radius|
if radius > 10 # for a radius above 10, award 0 points
0
elsif radius < 5 # for a radius less than 5, award 10 points
10
else # for a radius between 5 and 10 inclusive, award 5 points
5
end
end
# if all radiuses are under 5 (10 points), award an extra 100 points
score.count(10) >= radiuses.length ? score.reduce(:+) + 100 : score.reduce(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schubert; end",
"def schumann; end",
"def zuruecksetzen()\n end",
"def berlioz; end",
"def bellini; end",
"def berg; end",
"def suivre; end",
"def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end",
"def GueltigBis\n \treturn @GueltigBis\n end",
"def verdi; end",
"def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end",
"def einschalten() \n @schirm.farbe_aendern('gelb')\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n @leuchtstrahl1.farbe_aendern('gelb')\n @leuchtstrahl2.farbe_aendern('gelb')\n @leuchtstrahl3.farbe_aendern('gelb')\n @leuchtstrahl4.farbe_aendern('gelb')\n end",
"def bs; end",
"def intelligenter_zug(spielfeld, aktueller_spieler)\n zug = nil\n\n spieler = spielfeld.spieler\n gegner = nil\n for s in spieler\n if s.name != aktueller_spieler.name\n gegner = s\n break\n end\n end\n\n # 1. Regel: Zuerst nach einer Gewinnsituation suchen\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Wenn der aktuelle Spieler in einer Reihe bereits zwei Felder\n # besetzt hält und das dritte frei ist, dann natürlich das nehmen\n if (frei.size == 1) and (besetzt[aktueller_spieler].size == 2)\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n\n if zug.nil?\n # 2. Regel: Suche dann nach den Reihen, in denen der Gegner bereits\n # genau 2 Felder besetzt hat und das dritte Feld noch frei ist.\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Gefährlich, wenn Gegner zwei besetzt hält. Wie in der vorherigen\n # Lektion gelernt, erhält man zum Index des aktuellen Spielers\n # in der Spielerliste den Index des Gegners mit der Bitoperation 1^wer\n if (frei.size == 1) and (besetzt[gegner].size == 2)\n # Jetzt muss der Spieler unbedingt das eine freie Feld besetzen!\n # Andernfalls kann der Gegner im nächsten Zug gewinnen.\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n end\n\n # Eckensituation bestimmen\n ecken = {\n 1 => 0, # links oben\n 3 => 0, # rechts oben\n 7 => 0, # links unten\n 9 => 0 # rechts unten\n }\n gegen_ecken = [[1, 9], [9, 1], [3, 7], [7, 3]]\n for z in spielfeld.zuege\n feld = z.nummer\n # Gegner besetzt die Ecke, wenn:\n # feld ist eine Ecke und Gegner besetzt sie\n if (ecken[feld] != nil) and (z.spieler == gegner)\n # Markiere Ecke als vom Gegner besetzt\n ecken[feld] = 1\n end\n end\n\n # 3. Regel: Immer in die Mitte setzten, falls dort frei ist\n # Vorsicht vor der XOX Situation an der Diagonale!\n if zug.nil?\n frei = spielfeld.freie_felder\n mitte = 5\n if frei.include?(mitte)\n zug = Zug.new(aktueller_spieler, mitte)\n else\n # Aha, Mitte ist bereits besetzt.\n # Sofern sie vom aktuellen Spieler besetzt ist, dann nach der XOX\n # Situation Ausschau halten und den nächsten Zug nicht in eine Ecke setzen.\n # XOX (oder OXO) Situation besteht, wenn\n # Ecke 1 und 9 vom Gegner besetzt und aktueller Spieler auf 5 oder\n # Ecke 3 und 7 vom Gegner besetzt und aktueller Spieler auf 5.\n for ecken_paar in gegen_ecken\n besetzt, frei_ecken = spielfeld.reihen_status([ecken_paar[0], mitte, ecken_paar[1]])\n if besetzt[gegner].include?(ecken_paar[0]) and besetzt[gegner].include?(ecken_paar[1])\n if besetzt[aktueller_spieler].include?(mitte)\n # Jetzt also nicht in eine freie Ecke setzen, sondern auf\n # die Felder 2, 4, 6 oder 8, sofern sie frei sind.\n xox_felder = [2, 4, 6, 8]\n for f in xox_felder\n if !frei.include?(f)\n xox_felder.delete(f)\n end\n end\n # Von den freien Ausweichfeldern zufällig eines nehmen\n feld = zufalls_feld(xox_felder)\n if feld != nil\n zug = Zug.new(aktueller_spieler, feld)\n break\n end\n end\n end\n end\n\n end\n end\n\n # 4. Regel: Verteidige gegenüberliegende Ecke\n frei = spielfeld.freie_felder\n if zug.nil?\n # Wenn Ecke 1 besetzt, dann setze auf 9, oder umgekehrt (sofern frei).\n # Wenn Ecke 3 besetzt, dann setze auf 7, oder umgekehrt (sofern frei).\n for ecken_paar in gegen_ecken\n if (ecken[ecken_paar[0]] > 0) and (frei.include?(ecken_paar[1]))\n zug = Zug.new(aktueller_spieler, ecken_paar[1])\n break # nicht weitersuchen\n end\n end\n end\n\n # 5. Regel: Setze in irgendeine freie Ecke.\n # Verwende Variablen 'frei' und 'ecken' von oben\n if zug.nil?\n for ecke in ecken.keys\n if frei.include?(ecke)\n zug = Zug.new(aktueller_spieler, ecke)\n break # nicht weitersuchen\n end\n end\n end\n\n # Andernfalls Zufallszug machen\n if zug.nil?\n zug = zufalls_zug(spielfeld, aktueller_spieler)\n end\n\n zug\n end",
"def blg; end",
"def im_nachbarraum_umsehen(richtung)\n naechster_raum = @aktueller_raum.ausgang(richtung)\n puts naechster_raum\n end",
"def sichtbar_machen()\n end",
"def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end",
"def blam!\n berzerk? ? w00t! : super\n end",
"def terpene; end",
"def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end",
"def ausschalten()\n @schirm.farbe_aendern('orange')\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end",
"def ausgabe\n\t\t@name\n\t\n\tend",
"def sn\n end",
"def bizet; end",
"def sichtbar_machen()\n # TODO\n end",
"def weber; end",
"def ausgabe\n\t\t@name\n\tend",
"def sichtbar_machen\n @fuss.sichtbar_machen\n @stiel.sichtbar_machen\n @schirm.sichtbar_machen\n unless @tag\n @leuchtstrahl1.sichtbar_machen\n @leuchtstrahl2.sichtbar_machen\n @leuchtstrahl3.sichtbar_machen\n @leuchtstrahl4.sichtbar_machen\n end\n end",
"def formation; end",
"def langsam_vertikal_bewegen(entfernung)\n absolute_entfernung = entfernung\n if sichtbar? \n delta = 1\n if entfernung < 0 \n delta = -1\n absolute_entfernung = - entfernung\n end \n x_delta = 0\n y_delta = delta\n Leinwand.gib_einzige_instanz().\n bewege(self,absolute_entfernung,x_delta,y_delta)\n end \n @spitze = @spitze + Punkt.new(0,entfernung)\n end",
"def jack_handey; end",
"def stderrs; end",
"def funktionsname\n\tanweisung\nend",
"def sea; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def saludanombre(nombre)\n\tputs \"Estimado Señor #{nombre}\"\nend",
"def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end",
"def sichtbar_machen()\n @fuss.sichtbar_machen()\n @stiel.sichtbar_machen()\n @schirm.sichtbar_machen()\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n end",
"def feruchemist; end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def unsichtbar_machen()\n end",
"def strain; end",
"def sigla; @nome; end",
"def sauvegarderJeu()\n\t\t# création de la sauvegarde\n\t\t@sauvegarde = Sauvegarde.creer( self.joueur,self.carte,self.nbTour )\n\n @sauvegardeYaml = SauvegardeYAML.creer(self.joueur.nom)\n @sauvegardeYaml.enregistrement( self.sauvegarde)\n\n\tend",
"def mitch_hedberg; end",
"def sld; end",
"def gounod; end",
"def gluck_french; end",
"def squeek\r\n\t\treturn \"eeeep\"\r\n\tend",
"def unsichtbar_machen\n @fuss.unsichtbar_machen\n @stiel.unsichtbar_machen\n @schirm.unsichtbar_machen\n @leuchtstrahl1.unsichtbar_machen\n @leuchtstrahl2.unsichtbar_machen\n @leuchtstrahl3.unsichtbar_machen\n @leuchtstrahl4.unsichtbar_machen\n end",
"def herald; end",
"def check_bingo\n\t\t\n\tend",
"def wertungWorte (wertung)\n if wertung < 1\n return 'unglaublich schlecht'\n elsif wertung < 2\n return 'wirklich schlecht'\n elsif wertung < 3\n return 'relativ schlecht'\n elsif wertung < 4\n return 'in ordnung'\n elsif wertung < 5\n return 'relativ gut'\n elsif wertung < 6\n return 'wirklich gut'\n elsif wertung < 7\n return 'sehr gut'\n elsif wertung < 8\n return 'hervorragend'\n elsif wertung < 9\n return 'unbeschreiblich gut'\n elsif wertung < 10\n return 'betörend gut'\n elsif wertung < 11\n return 'unwirklich gut'\n else\n return 'katastrophal gut'\n end\n end",
"def rossini; end",
"def dh; end",
"def folge_berechnen(tn,jahr)\n folge = [ \"\" ]\n ges_einsaetze = \"28.12.#{jahr}\".to_date.cweek\n ger_schalter = 1\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n zaehler = 0\n while folge.size <= ges_einsaetze\n namen.each do |name|\n unless tn[name].find_index(folge.size) || folge.size > ges_einsaetze\n folge << name\n zaehler += 1\n end\n end\n if zaehler == 0\n if namen.size < tn.size && ger_schalter == 1\n ger_schalter = 0\n else\n folge << \"nicht besetzt!\"\n ger_schalter = 1\n end\n end\n zaehler = 0\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n end\n return folge \n end",
"def singular_siegler; end",
"def nach_unten_bewegen\n bewegen_um_punkt(Punkt.new(0,10))\n end",
"def buzzword; end",
"def buzzword; end",
"def mambo_no_5; end",
"def gerund\n b = gerundive.sub( /.*\\s+(.*)um.*$/, \"\\\\1\" )\n b += \"ī, ō, etc.\"\n return b\n end",
"def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end",
"def herebody_s; end",
"def drittelworte( wertung )\n if wertung < 1\n string1 = ''\n elsif wertung < 2\n string1 = 'eins'\n elsif wertung < 3\n string1 = 'zwei'\n elsif wertung < 4\n string1 = 'drei'\n elsif wertung < 5\n string1 = 'vier'\n elsif wertung < 6\n string1 = 'fünf'\n elsif wertung < 7\n string1 = 'secht'\n elsif wertung < 8\n string1 = 'sieben'\n elsif wertung < 9\n string1 = 'acht'\n elsif wertung < 10\n string1 = 'neun'\n elsif wertung < 11\n string1 = 'zehn'\n elsif wertung < 12\n string1 = 'elf'\n else\n string1 = 'zwöf'\n end\n rest = sprintf(\"%.1f\",(wertung.to_f % 1))\n if rest.to_f == 0.3\n return string1 + \" ein drittel\"\n elsif rest.to_f == 0.6\n return string1 + \" zwei drittel\"\n elsif rest.to_f == 0\n return string1\n else\n return sprintf(\"%.1f\",wertung.to_s).sub(\".\",\",\")\n end\n end",
"def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end",
"def unsichtbar_machen()\n @fuss.unsichtbar_machen()\n @stiel.unsichtbar_machen()\n @schirm.unsichtbar_machen()\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end",
"def bellini\n fetch('opera.italian.by_vincenzo_bellini')\n end",
"def ausgleich\n\t\tsums = {}\n\t\t%w(jo caro).each do |who|\n\t\t\tsums[who] = @db.get_first_value(\"select summe from sum_#{who} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} and gemeinsam = 'g'\").to_f\n\t\tend\n\n\t\tif(sums['jo'] == sums['caro'])\n\t\t\tputs \"Gleichstand\"\n\t\t\treturn\n\t\tend\n\n\t\tausg = ((sums['jo'] + sums['caro']) / 2 - sums['jo']).abs\n\t\t\n\t\tif(sums['jo'] > sums['caro'])\n\t\t\tprintf(\"Caro an Jo: %.2f EUR\\n\", ausg)\n\t\telse\n\t\t\tprintf(\"Jo an Caro: %.2f EUR\\n\", ausg)\n\t\tend\n\t\t\n\tend",
"def bstardrag\n bstar\n end",
"def guct\n end",
"def romeo_and_juliet; end",
"def sb(t, s, c)\n\n end",
"def insult_swabbie\n return case self.swab\n when :counter\n self.boatswain\n when :timestamp\n self.coxswain\n else\n \"\"\n end\n end",
"def spren; end",
"def horizontal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(anzahl,0)) \n end",
"def malts; end",
"def zapis_vysledek(reseni, je_splnitelna) \n @reseni = reseni\n @vysledny_soucet_vah = vrat_soucet_vah(reseni)\n @je_splnitelna = je_splnitelna\n end",
"def breathe\n \"i get oxygen from the water\"\n end",
"def isbn; end",
"def chargementJeu(nomJoueur)\n @sauvegardeYaml = SauvegardeYAML.creer(nomJoueur)\n @sauvegarde = @sauvegardeYaml.chargement()\n @joueur = @sauvegarde.joueur\n [email protected](\".\")\n @joueur.nom = nom[0]\n print @joueur.nom\n @carte = @sauvegarde.carte\n @nbTour = @sauvegarde.nbTour\n\tend",
"def Blast\n\n\t\nend",
"def who_we_are\r\n end",
"def An()\n return @RownanieWielomianu.first.Wspolczynnik\n end",
"def gram_schmidtR\n gram_schmidt[1]\n end",
"def gusts \n \"gusts\" \n end",
"def hiss; end",
"def PodstawAn(ans) \n @RownanieWielomianu.each{ |wezel| \n if(ans.key?(wezel.Wspolczynnik))\n wezel.Wspolczynnik = ans[wezel.Wspolczynnik]\n end\n }\n end",
"def scientist; end",
"def england\n end",
"def tongue_twister; end",
"def probers; end",
"def zlosniwa\r\n raise # ponownie zglasza biezacy wyjatek\r\n raise \"Houston, we've got a problem!\" # zglasza RuntimeError\r\n raise InterfaceException, \"Blad klawiatury\", caller # ustawia komunikat i slad stosu\r\nend",
"def test_sbb\n puts Sbb.find('geneva', 'berne', Time.utc(2007,\"feb\",8,13,0,0)).inspect\n end",
"def mi_carrera\n\n\tend",
"def name; termid;end",
"def vin; end"
] | [
"0.7576614",
"0.70595306",
"0.6850953",
"0.68300265",
"0.6652317",
"0.6635704",
"0.64665234",
"0.63879704",
"0.6330819",
"0.6307666",
"0.62543666",
"0.6253937",
"0.624926",
"0.6169856",
"0.61295396",
"0.6115479",
"0.6113548",
"0.6109211",
"0.6101353",
"0.60676706",
"0.6044888",
"0.60421085",
"0.60111254",
"0.60101676",
"0.600944",
"0.59913373",
"0.59817106",
"0.59649557",
"0.590478",
"0.5880659",
"0.58578277",
"0.5843083",
"0.58184266",
"0.5812214",
"0.58086973",
"0.5806323",
"0.5806323",
"0.5806323",
"0.5806323",
"0.5767323",
"0.5766141",
"0.5747116",
"0.57454497",
"0.57277894",
"0.57056093",
"0.5702362",
"0.5674423",
"0.56541294",
"0.5639651",
"0.56295735",
"0.56231767",
"0.56141925",
"0.56083107",
"0.56040084",
"0.5592942",
"0.55865866",
"0.5571775",
"0.5541313",
"0.5535259",
"0.55208844",
"0.5517274",
"0.5509007",
"0.5508371",
"0.5508371",
"0.5499663",
"0.5489449",
"0.54837984",
"0.5481399",
"0.5458728",
"0.545015",
"0.5447507",
"0.5441904",
"0.54382044",
"0.54280895",
"0.54251796",
"0.5423542",
"0.5417894",
"0.5393028",
"0.5392647",
"0.5391713",
"0.5387715",
"0.5383053",
"0.53825873",
"0.5380288",
"0.5377187",
"0.5375708",
"0.53661525",
"0.5361911",
"0.5354287",
"0.5353342",
"0.5353063",
"0.5351982",
"0.53401613",
"0.53361946",
"0.53290504",
"0.5327695",
"0.5324891",
"0.53243613",
"0.5318225",
"0.53112805",
"0.53094244"
] | 0.0 | -1 |
alternative with nested ternary operator | def score_throws2(radiuses)
# iterate through the radiuses and award points:
# - 0 points for a radius of 10 or more
# - 5 points for a radius between 5 and 10
# - 10 points for a radius under 5
score = radiuses.map { |x| x < 5 ? 10 : x > 10 ? 0 : 5 }
# if all radiuses are under 5 (10 points), award an extra 100 points
score.count(10) >= radiuses.length ? score.reduce(:+) + 100 : score.reduce(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend",
"def render_output_of_ternary(ternary_arr, df_data)\n value_for_field_name(ternary_arr[0], df_data).present? ? ternary_arr[1] : ternary_arr[2]\n end",
"def ternary_condition(value)\n\t\tis_strike?(value) ? 10 : value\n\tend",
"def not_if(val) val ? :not_to : :to end",
"def conditionally(*) end",
"def conditionally(*) end",
"def vowels_with_ternary_operator(letter)\n (vowels.include? letter) ? true : false # this only seems to work when I put the conditional in parenthesis\nend",
"def see_color_with_nested_ternary(str)\n # rubocop:disable Style/NestedTernaryOperator\n str.start_with?('red') ? 'red' : str.start_with?('blue') ? 'blue' : ''\n # rubocop:enable Style/NestedTernaryOperator\n end",
"def or_else(&blk)\n yield value\n end",
"def hello_world(lang)\n lang == \"es\" ? result = \"Hola Mundo\" : lang == \"de\" ? result = \"Hallo Welt\" : result = \"Hello World\"\n p result\nend",
"def on_ifop(statement, true_val, false_val)\n return Node.new(\n :ternary,\n [statement, true_val, false_val],\n metadata\n )\n end",
"def cog\n @cog * (foo? ? bar_adjustment : baz_adjustment)\nend",
"def yeah_or_booh boolean\n boolean && 'yeah' || 'booh'\nend",
"def on_ternary_if(node)\n comparsion, op = node.children\n node.children.concat op.children.slice!(2..-1)\n\n on_ternary_if_boolean(node)\n end",
"def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend",
"def yeah_or_boo( a,b )\n (a > b) && 'yeah' || 'boo'\nend",
"def foo a\r\n if a==1; \"one\" elsif a==2; \"two\" else \"unknown\" end\r\nend",
"def getOrElse *args\n @val\n end",
"def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if !empty? then value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end",
"def expand_elses(branch); end",
"def expand_elses(branch); end",
"def on_ternary_if_boolean(node)\n comparsion, condition, if_true, if_false = node.children\n if comparsion\n node.update(:ternary, [ condition, if_true, if_false ])\n else\n node.update(:ternary, [ condition, if_false, if_true ])\n end\n end",
"def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if either_value.left? then either_value.left_value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end",
"def _reduce_337(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_339(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n\n result\nend",
"def get_or_else(val_or_lam = nil, &blk)\n v_or_f = val_or_lam || blk\n if either_value.right? then either_value.right_value else (v_or_f.respond_to?(:call) ? v_or_f.call : v_or_f) end\n end",
"def _reduce_331(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_342(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_342(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_336(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_16(val, _values, result)\n result = IfElse.new(val[2], val[4], []) \n result\nend",
"def _reduce_337(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_337(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def compile_ternif(scope, cond, alt)\n if alt.is_a?(Array) && alt[0] == :ternalt\n if_arm = alt[1]\n else_arm = alt[2]\n else\n if_arm = alt\n end\n compile_if(scope,cond,if_arm,else_arm)\n end",
"def compile_ternif(scope, cond, alt)\n if alt.is_a?(Array) && alt[0] == :ternalt\n if_arm = alt[1]\n else_arm = alt[2]\n else\n if_arm = alt\n end\n compile_if(scope,cond,if_arm,else_arm)\n end",
"def _reduce_349(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_344(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_349(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def non_complex_expression?(condition); end",
"def complex_condition?(condition); end",
"def even_odd(number)\n number.even? ? \"#{number} is even!\" : \"Noo! #{number} is odd!!!\"\n #last line, one statement, this will be auto returned from defined method\nend",
"def make_if test, zero, not_zero\n noop = \":\"\n \"if [ \\\"0\\\" -eq \\\"$#{test}\\\" ]; then #{zero || noop}; else #{not_zero || noop} ; fi\"\n end",
"def _reduce_367(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_342(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n\n result\nend",
"def _reduce_355(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_355(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_355(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_354(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def triple_expression?; false; end",
"def _reduce_357(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def some_method(x)\n if x > 5 && x < 10\n return :a\n elsif x < 5\n return :b\n end # else??\n \n :c\nend",
"def _reduce_356(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_356(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_356(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_356(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def br(test, exp1, exp2)\n test ? exp1 : exp2\n end",
"def _reduce_367(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n\n result\nend",
"def _reduce_336(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_354(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_354(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n\n result\nend",
"def conditionally_true\n\t\t!!self\n\tend",
"def _reduce_353(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_353(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_353(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_353(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_353(val, _values, result)\n result = s(:if, val[1], val[3], val[4])\n \n result\nend",
"def _reduce_343(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_474(val, _values, result)\n body, _, cond = val\n body = remove_begin body\n\n result = s(:if, cond, body, nil).line body.line\n\n result\nend",
"def or_b\n end",
"def build_nested_if(exprs, conds, options = {})\\\n unless options[:dont_optimize]\n # optimize by joining conditions for identical expressions\n # first build a hash\n expr_hash = {}\n exprs.each_with_index do |expr, i|\n expr_hash[expr] ||= []\n expr_hash[expr] << conds[i]\n end\n\n # rebuild condensed exprs and conds arrays\n exprs, conds = [], []\n expr_hash.each do |expr, cond_set|\n exprs << expr\n conds << cond_set.join(\" OR \")\n end\n end\n\n if exprs.size == 1\n return exprs.first\n else\n rest = build_nested_if(exprs[1..-1], conds[1..-1], :dont_optimize => true)\n \"IF(#{conds.first}, #{exprs.first}, #{rest})\"\n end\n end",
"def and_then &block\n if @value == nil\n Default.new @fallback, nil\n else\n Default.new @fallback, block.call(@value)\n end\n end",
"def calculate_bonus(num, boolean)\n boolean ? num / 2 : 0\nend",
"def is_it_a_baby(age)\n age < 2 ? \"baby\" : \"not a baby\"\nend",
"def or_nil\n get_or_else(nil)\n end",
"def even_or_odd(num)\n num.even? ? \"That is an even number\" : \"That number is not even\"\nend",
"def even_or_odd(number)\n number.even? ? 'That number is even ' : 'That number is odd'\nend",
"def odd_or_even(number)\n number.odd? ? \"The number is odd\" : \"The number is even\"\nend",
"def _reduce_343(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n\n result\nend",
"def check_else(els)\n # put through translator with original target to mimic as if\n # else were change;\n # literal=true to make sure always x>y syntax\n return initial(@rule[0], els, true).sub(/\\A(.*)>/, '').strip\n end",
"def _reduce_345(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def even_or_odd(number)\n number.even? ? \"Even\" : \"Odd\"\nend",
"def value_or_default\n self.value || self.default || self.try_alternate\n end",
"def value_or_default\n self.value || self.default || self.try_alternate\n end",
"def c2= c; @c2 = (c == 1) ? 1 : 0; end",
"def is_old? #any tiem you see a method with a ? after it only returns a true or false value\n @age > 80 ? true : false #ternary value\n # the method below\n # if @age > 80\n # true\n # else\n # false\n end",
"def if_nil(val, default)\n if val.nil?\n return default\n end\n return val\n end",
"def _reduce_340(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def _reduce_340(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def power_or_default_square(num, *args)\n args[0] ? num**args[0] : num**2\nend",
"def if_proc=(_arg0); end",
"def or_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) || get_value(right)\n end",
"def value_if_false\n return @value_if_false\n end",
"def calculate_bonus(salary, bool)\n bool ? (salary / 2) : 0\nend",
"def _reduce_351(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n \n result\nend",
"def or_c\n end",
"def cf_or ( a, b )\r\n# Combine for 'A or B'\r\n if a>0 and b>0\r\n a + b - a*b\r\n elsif a<0 and b<0\r\n a + b + a*b\r\n else\r\n (a + b) / ( 1 - [a.abs, b.abs].min )\r\n end\r\nend",
"def my_if(condition, then_clause, else_clause)\n if condition\n then_clause.call\n else\n else_clause.call\n end\nend",
"def _reduce_330(val, _values, result)\n else_t, else_ = val[4]\n result = [ val[0],\n @builder.condition(val[0], val[1], val[2],\n val[3], else_t,\n else_, nil),\n ]\n\n result\nend",
"def _reduce_372(val, _values, result)\n (_, line), c, _, t, rest = val\n\n result = s(:if, c, t, rest).line line\n\n result\nend",
"def _reduce_372(val, _values, result)\n (_, line), c, _, t, rest = val\n\n result = s(:if, c, t, rest).line line\n\n result\nend",
"def value_if_true\n return @value_if_true\n end"
] | [
"0.74793935",
"0.6314791",
"0.6291511",
"0.6205085",
"0.6082724",
"0.6082724",
"0.6052779",
"0.5970924",
"0.5928399",
"0.59050435",
"0.5882791",
"0.58359045",
"0.5814862",
"0.5783756",
"0.57529527",
"0.5725366",
"0.567018",
"0.56652635",
"0.5652926",
"0.5634376",
"0.5634376",
"0.5634093",
"0.5611072",
"0.5543105",
"0.5522436",
"0.54912454",
"0.5480353",
"0.5447931",
"0.5447931",
"0.5446356",
"0.5443262",
"0.5442509",
"0.5442509",
"0.54274124",
"0.54274124",
"0.542519",
"0.5414327",
"0.54089063",
"0.5405232",
"0.54038477",
"0.5393708",
"0.5393135",
"0.5392173",
"0.5381128",
"0.5366968",
"0.5366968",
"0.5366968",
"0.5364842",
"0.5359885",
"0.5348174",
"0.53367007",
"0.5332918",
"0.5332918",
"0.5332918",
"0.5332918",
"0.5329472",
"0.531599",
"0.5311718",
"0.5308257",
"0.530116",
"0.53008986",
"0.5292828",
"0.5292828",
"0.5292828",
"0.5292828",
"0.5292828",
"0.52860487",
"0.52630574",
"0.5253615",
"0.5252212",
"0.52340865",
"0.52276856",
"0.52172357",
"0.52169114",
"0.52115285",
"0.52107424",
"0.5209441",
"0.52088696",
"0.52065504",
"0.5205794",
"0.5197198",
"0.5194452",
"0.5194452",
"0.5190897",
"0.51874167",
"0.5187189",
"0.5181964",
"0.5181964",
"0.5172902",
"0.51616406",
"0.5153338",
"0.514887",
"0.51432353",
"0.5139023",
"0.5136545",
"0.51194245",
"0.5118011",
"0.51167434",
"0.51154536",
"0.51154536",
"0.5095458"
] | 0.0 | -1 |
next if i == 0 | def fizz_buzz(i)
if i % 3 == 0 && i % 5 == 0
"fizzbuzz"
elsif i % 3 == 0
"fizz"
elsif i % 5 == 0
"buzz"
else
i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n last? ? nil : locate + 1\n end",
"def next\n last? ? nil : @collection[index + 1]\n end",
"def _skip_next\n @index += 1\n\n self\n end",
"def next\n next? ? @current + 1 : nil\n end",
"def next_element\n validates_possibility_of :next\n self.index += 1\n self.current\n end",
"def at(index)\n current_node = @head\n index.times do\n current_node = current_node.next_node\n if current_node.next_node == nil\n puts \"no data\"\n break\n end\n end\n current_node\n end",
"def traverse(i)\n return nil if head.nil?\n node = head\n i.times { node = node.next }\n return node\n end",
"def next\r\n next_values[0]\r\n end",
"def next()\n x = @arr[@i]\n @i += 1\n x\n end",
"def next\n\t\tself + 1\n\tend",
"def next\n self.offset(1)\n end",
"def next\n at(position + 1)\n end",
"def next\n\t\tend",
"def first?\n self.index == 0\n end",
"def at_no_data(index)\n node = @head\n count = 0\n size.times do\n break if index == count\n node = node.next_node\n count += 1\n end\n return node\n end",
"def next\n if self.last?\n first_in_section\n else lower_item\n end\n end",
"def first?\n index == 0\n end",
"def next() end",
"def next() end",
"def swap_with_next i\n #if first_item >= first_item.next_list_item\n\n end",
"def next\n @next||=after.first\n end",
"def next\n layout.rows[number+1] unless last?\n end",
"def at(index)\n curr = head\n index.downto(1) do |_|\n break if curr.nil?\n\n curr = curr.next\n end\n curr\n end",
"def has_next()\n @i <= @arr.length && @arr[@i] != nil\n end",
"def [](i)\n each_with_index { |link, j| return link if i == j }\n nil\n end",
"def next!() end",
"def get_node(i=0)\n nodes.select {|a| a.number == i.to_i}.first\n end",
"def each_with_index(node=@head)\n i = 0\n until node.nil?\n result = yield(node, i)\n node = node.next_node\n i += 1\n end\n result\n end",
"def next(pointer); end",
"def next(pointer); end",
"def first?\n\t\treturn @iteration == 0\n\tend",
"def next\n end",
"def next\n end",
"def next\n @pointer += 1\n end",
"def next_element; end",
"def next\n @next && @next.value\n end",
"def next_skip_line_number\n first = self.next\n first.type == :integer ? self.next : first\n end",
"def intend_next\n intend_with :first, :next\n end",
"def intend_next\n intend_with :first, :next\n end",
"def test_next_statement\n i = 0\n result = []\n while i < 10\n i += 1\n next if (i % 2) == 0\n result << i\n end\n assert_equal (1..10).step(2).to_a, result\n end",
"def first?\n index == 0\n end",
"def first?\n index == 0\n end",
"def next_i\n raise \"implement in subclass\"\n end",
"def next\n return @next if defined? @next\n\n @next = course.levels.offset(level_number + 1).first\n end",
"def [](idx)\n raise \"index out of bounds\" if idx < 0\n\n link = first\n (idx + 1).times do\n link = link.next\n\n # We overran the list if we ever hit the sentinel.\n raise \"index out of bounds\" if link == last\n end\n\n link\n end",
"def next\n @next\n end",
"def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend",
"def next\n @count += 1\n self\n end",
"def [](index)\n if index >= 0\n node = @head\n index.times do\n node = node.next if node\n end\n elsif index < 0\n node = last\n iter = (index * -1) - 1 # convert neg to pos and\n # - 1 bc node = last\n (iter).times do\n node = prev node\n end\n end\n node ? node.value : nil\n end",
"def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end",
"def set_first\n return 0 if @first_item.nil?\n first = 0\n (0..item_max - 1).each { |i|\n first = i if @data[i].id == @first_item\n }\n @index = first\n end",
"def next\n return nil unless @node\n @node = @node.next\n while @index < @table.size and @node == nil\n @index += 1\n @node = @table[@index]\n end\n return @node == nil ? nil : @node.item\n end",
"def next\n (successors.length == 1) ? successors.first : nil\n end",
"def next_item\n @current += 1 if @current < last\n\n items\n end",
"def item_at_head\n\t\t\[email protected]\n\t\tend",
"def next()\n \n end",
"def next()\n \n end",
"def get_next\n\t\t\n\tend",
"def has_next()\n !@array[@k+1].nil?\n end",
"def at(index)\n\t\tx = @head\n\t\ty = 0\n\t\tuntil x == nil\n\t\t\tif y == index\n\t\t\t\treturn x\n\t\t\tend\n\t\t\ty += 1\n\t\t\tx = x.next\n\t\tend\n\tend",
"def next\n\t\tlines.shift\n\tend",
"def next()\n @array[@k+=1]\n end",
"def at(index)\n return nil if index < 0 || index > @size \n temp = @head\n index.times { temp = temp.next_node}\n temp\n end",
"def next!\r\n @cur = @cache[@idx+=1]\r\n end",
"def odd_elems(arr)\n arr.each do\n |el|\n next if el % 2 == 0\n puts el\n end\nend",
"def next_hack(n)\n return n.next if hack? n.next\n next_hack n.next\nend",
"def next\n\t\t# Use up all of the extras\n\t\treturn @extras.pop if [email protected]?\n\t\t# Then track the last freeid used (which should always be the max)\n\t\treturn (@last+=1)-1\n\tend",
"def at(index)\n node = @head\n index.times do\n node = node.next_node\n return nil if node.nil?\n end\n node\n end",
"def has_next?; end",
"def next\n\t\t\t\t@index += 1\n\t\t\t\tself._update\n\t\t\t\tself\n\t\t\tend",
"def run_block_with_next\n numbers = []\n\n (1..20).each do |number|\n next if number.odd?\n numbers << number\n end\n\n numbers\nend",
"def test_next_no_neighbors\r\n\t\tassert_nil @t.next\r\n\tend",
"def find_at(index)\n return if (index + 1) > count || index < 0\n\n item = @head\n index.times { item = item.next }\n item.value\n end",
"def next\n\t\t@skip = (@skip || 0) + get_resultcount\n\t\t@result = nil\n\t\treturn self\n\tend",
"def begin\n empty? ? 0 : first.begin\n end",
"def next!\n rotate!.first\n end",
"def next()\n result = current\n @index += 1\n @got_next_element = false\n @next_element = nil\n result\n end",
"def [](i)\n i = i + size if i < 0\n i >= size || i < 0 ? nil : @elements[i]\n end",
"def next\n block.instructions[index+1] || (block.next ? block.next.instructions.first : nil)\n end",
"def [](idx)\n return nil if idx >= @size\n while idx >= @so_far.size\n @so_far << generate_next\n end\n @so_far[idx]\n end",
"def next!\n return nil if @players.empty?\n \n begin\n @players[@next % @players.size]\n ensure\n skip! # shift the next pointer\n end\n end",
"def next(pointer)\n super\n \n raise 'Not implemented'\n end",
"def next\n raise NotImplementedError\n end",
"def next\n raise NotImplementedError\n end",
"def next2\n vehicles = [\"car\", \"ship\", \"plane\", \"submarine\", \"train\"]\n i = 0\n while i < vehicles.size\n v = vehicles[i]\n i += 1\n next if v.length == 5\n puts v\n end\nend",
"def loop_with_next\n numbers = []\n counter = 0\n\n while counter < 20\n counter += 1\n next if counter.even?\n numbers << counter\n end\n\n numbers\nend",
"def skip!(count = 1)\n @next += count * (@upwards ? 1 : -1)\n end",
"def at_index(index)\n if head == nil\n \"Theres nothing in the list\"\n else\n tmp = head\n i = 0\n while i != index\n tmp = tmp.next_node\n i += 1\n end\n tmp\n end\n end",
"def node_at(index)\n if index >= self.size\n puts \"index out of range.\"\n else\n each_with_index do |node, i|\n return node if index == i \n end\n end\n end",
"def next( insn )\n # TODO\n end",
"def at(index)\n return @tail if index == -1\n return @head if index == 0\n\n counter = 1\n current_node = @head.next_node\n until counter == index\n current_node = current_node.next_node\n counter += 1\n end\n current_node\n end",
"def iterator?() end",
"def goto_next\n pointer, matching_pointers = @itr_pointer.next(@builder['skip_matched_checkbutton'].active?, true)\n if (pointer == nil)\n if @single\n self.destroy\n else\n @itr_pointer.reset\n pointer, matching_pointers = @itr_pointer.next(@builder['skip_matched_checkbutton'].active?, true)\n if (pointer == nil)\n notify('No more items to compare')\n else\n @idx_comparison = 0\n notify('Cycling items to compare from the beginning')\n end\n end\n else\n @idx_comparison += 1\n notify('')\n end\n load_comparison(pointer, matching_pointers)\n end",
"def next\n peek.tap { @position += 1 }\n end",
"def next\n parent[parent.place(self) + 1]\n end",
"def next\n @mut.synchronize{@array.sort![-1]}\n end",
"def has_next()\n \n end",
"def has_next()\n \n end",
"def first\n enumerator(:limit => 1).first \n end",
"def next_vowels(vowel)\n\n # block runs list\n VOWELSLIST.length.times do |item|\n if vowel == VOWELSLIST[item - 1]\n vowel = VOWELSLIST[item]\n break\n end\n end\n vowel\nend",
"def next_l\n raise \"implement in subclass\"\n end"
] | [
"0.6729079",
"0.6721046",
"0.67178303",
"0.6406716",
"0.6356957",
"0.6330086",
"0.632083",
"0.6305282",
"0.63043344",
"0.62911993",
"0.62590045",
"0.62574613",
"0.6242473",
"0.6237886",
"0.6227054",
"0.6193385",
"0.6176517",
"0.6135584",
"0.6135584",
"0.6121829",
"0.6104131",
"0.6089115",
"0.6062925",
"0.6062425",
"0.6059354",
"0.6034832",
"0.60251933",
"0.6024733",
"0.6015772",
"0.6015772",
"0.60127604",
"0.60115135",
"0.60115135",
"0.6002197",
"0.5983408",
"0.5975486",
"0.59614927",
"0.5950061",
"0.5950061",
"0.5946459",
"0.5932272",
"0.5932272",
"0.59235907",
"0.5922814",
"0.5922137",
"0.5913832",
"0.5913808",
"0.5905649",
"0.5900743",
"0.59007007",
"0.5900148",
"0.5885387",
"0.58846277",
"0.58701926",
"0.5859801",
"0.58458495",
"0.58458495",
"0.5837525",
"0.58355576",
"0.5827038",
"0.5819166",
"0.5814551",
"0.5804657",
"0.58028126",
"0.5793316",
"0.5788281",
"0.5781415",
"0.5781255",
"0.5767695",
"0.57604635",
"0.5747626",
"0.5744506",
"0.57348114",
"0.5729193",
"0.5707769",
"0.5703695",
"0.57008195",
"0.5697129",
"0.5682296",
"0.5677053",
"0.56677866",
"0.56662524",
"0.5651822",
"0.5651822",
"0.564552",
"0.5614616",
"0.56046057",
"0.55981493",
"0.5594185",
"0.55827737",
"0.557943",
"0.55745924",
"0.5573253",
"0.55598265",
"0.55585825",
"0.55580485",
"0.5556034",
"0.5556034",
"0.554098",
"0.5540833",
"0.55379796"
] | 0.0 | -1 |
4. Write a method that counts down to zero using recursion. | def countdown(num)
if num <= 0
puts num
else
puts num
countdown(num-1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend",
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend",
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend",
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend",
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend",
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number-1)\n end\nend",
"def count_to_zero(number)\n if number <= 0\n puts number\n else\n puts number\n count_to_zero(number - 1)\n end\nend",
"def count_down(num) \n if num == 0\n p \"Houston, we have lift-off!\"\n return;\n end\n\n p num\n count_down(num - 1)\nend",
"def count_down(start)\n puts start\n if start > 0\n count_down(start -1)\n end\nend",
"def count_down(num)\n\n if num >=0\n puts num\n count_down(num-=1)\n else\n puts \"Complete!\"\n end\n\n\nend",
"def count_down(val)\n if val < 0\n puts 'All done!'\n else\n puts val\n val -= 1\n count_down(val)\n end\nend",
"def zero(number)\n if number <= 0\n puts number\n else\n puts number\n zero(number - 1)\n end\nend",
"def countdown_to_0(number)\n puts number\n if number > 0\n number -= 1\n countdown_to_0(number)\n end\nend",
"def calculate(num)\n return 0 if num.zero?\n num + calculate(num - 1)\nend",
"def zero(x)\n if x <= 0\n puts x\n else \n puts x\n zero(x - 1)\n end\nend",
"def count_down(num) \n if num == 0\n p \"Houston, we have lift-off!\"\n return;\n end\n\n p num\n count_down(num - 1)\n end",
"def recursive_countdown(num)\n if num >= 0\n puts num\n recursive_countdown(num-1)\n end\nend",
"def count_down(number)\n\tif number <= 0\n\t\tputs number\n\telse \n\t\tputs number\n\t\tnumber -= 1\n\t\tcount_down(number)\n\tend\nend",
"def downto_recursive\n num = 0\n 11.downto(1) do |num|\n num -= 1\n puts num\n end\nend",
"def count_down(start)\n\t puts start\n\t if start > 0\n\t count_down(start - 1)\n\t end\n\tend",
"def count_down(num)\n p num;\n count_down(num - 1)\n end",
"def countdown(num)\n puts num\n if num > 0\n countdown(num-1)\n end\nend",
"def countdown(num)\n if num > 0\n puts num\n countdown(num - 1)\n else\n puts num\n end\nend",
"def countdown(num)\r\n if num <= 0\r\n puts num\r\n else\r\n puts num\r\n countdown(num - 1)\r\n end\r\nend",
"def countdown(num)\n puts num\n if num > 0\n countdown(num - 1)\n end\nend",
"def countdown(num)\n puts num\n if num > 0\n countdown(num - 1)\n end\nend",
"def countdown(num)\n puts num\n if num > 0\n countdown(num - 1)\n end\nend",
"def countdown_rec( n=10 )\n\n # Define a \"base case\": a condition under which\n # this function STOPS calling itself recursively;\n # otherwise, you will have an infinite loop/regress\n # (actually you won't, you will just exceed the stack)\n if n < 0\n puts \"Blast off!\"\n else\n # Not finished counting, so perform recursive call\n #\n # BUT: we have to do so in a way that brings us\n # a step closer to reaching the base case defined\n # above, which stops the recursion (otherwise, infinite\n # loop)\n puts n\n sleep 0.3\n\n countdown_rec( n - 1 ) # recursive call\n\n puts \"Returned! (n = #{n})\"\n\n\n end # else\n\n\nend",
"def countdown(num)\n puts num\n if num <= 0\n puts num\n else\n countdown(num - 1)\n end\nend",
"def rec_countdown(num)\n if num <= 0\n puts num\n else\n puts num\n rec_countdown(num - 1)\n end \nend",
"def countdown(i)\n if i <= 0\n puts i\n else\n puts i\n countdown(i - 1)\n end\nend",
"def countdown(number)\n if number <= 0\n puts number\n else\n puts number\n countdown(number -1)\n end\nend",
"def countdown(start)\n if start <= 0\n puts start\n else\n puts start\n countdown(start - 1)\n end\nend",
"def countdown(num)\n if num <=0\n puts num\n else\n puts num\n countdown(num-1)\n end\nend",
"def countdown(number)\n puts number unless number < 0\n if number > 0\n countdown(number - 1)\n end\nend",
"def countdown(number)\n if number <= 0\n puts number\n else\n puts number\n countdown(number - 1)\n end\nend",
"def countdown(number)\n if number <= 0\n puts number\n else\n puts number\n countdown(number - 1)\n end\nend",
"def countdown (num)\n if num > 0\n puts num\n countdown(num - 1)\n else\n puts num\n num\n end\nend",
"def sum_recursively(num)\n return num if num == 0\n sum_recursively(num-1) + num\nend",
"def countdown(number)\n if number < 0\n return\n else\n puts \"#{number}\"\n countdown(number-1)\n end\nend",
"def countdown(num)\n if num >= 0\n puts num\n countdown(num-1)\n end\nend",
"def countdown(number)\n puts number\n if number > 0\n countdown(number - 1)\n end\nend",
"def reach_zero(num)\n num = num.to_i(2)\n count = 1\n\n until num === 0\n if num.even?\n num /= 2\n elsif num.odd?\n num -= 1\n end\n count += 1\n end\n count\nend",
"def countdown_r( n )\n\n # define a base case\n # (condition under which function STOPS calling itself)\n if n < 0\n puts \"Blast off!\"\n else\n # recursive case\n # the function calls itself, but in a way that always\n # brings us a step closer to the terminating base case\n puts n\n sleep 0.3\n countdown_r( n - 1 )\n end\n puts \"backing out of recursrion: n=#{n}\"\nend",
"def countdown(start)\n puts start\n if start > 0\n countdown(start - 1)\n end\nend",
"def down(start)\n if start <= 0\n puts start\n else\n puts start\n down(start-1)\n end\nend",
"def factorial(num)\n return 1 if num.zero?\n\n num * factorial(num - 1)\nend",
"def countdown(n)\n puts n\n if n > 0\n countdown( n - 1)\n end\nend",
"def countdown(number)\n if number < 1\n puts number\n else\n puts number\n countdown(number - 1)\n end\nend",
"def sum_recurse(num)\n return 0 if num == 0\n num[0] + sum_recurse(num.delete(1))\nend",
"def to_zero(n)\n\tif n >= 0\n\t\tputs n\n\t\tto_zero(n-1)\n\tend\nend",
"def countdown_recursive(n=10)\n if n < 0\n puts 'Blast Off!!'\n else\n puts n\n sleep 1\n countdown_recursive(n-1)\n end\nend",
"def countdown(num)\n if num <= 1\n puts \"KABOOM!\"\n else \n puts num\n countdown(num - 1)\n end \nend",
"def factorial_recursion(number)\n\t\ttotal = number\n\tif number > 0\n\t\ttotal = total \n\t\t\n\telse\n\t\tputs total\n\tend\n\n\n\nend",
"def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion x += 1\nend",
"def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion x += 1\nend",
"def fib_rec( n )\n $call_count += 1\n # Define the base case\n if n < 2\n return 1\n else\n # do the recursive calculation:\n return fib_rec( n - 1 ) + fib_rec( n - 2 )\n end\n\nend",
"def countdown num\n if num <= 0\n puts \"Happy New Year!\"\n else\n puts num\n countdown(num - 1)\n end\nend",
"def sum_nums(num)\n\ncount = num\n\nif( num == 0 )\n return num\nend\n\n while count > 0\n num += count - 1\n #puts \"Num: #{num}\"\n count -= 1\n #puts \"Count: #{count}\"\n end\n\n return num\nend",
"def countdown(n)\n\nif n <=0\n\tputs n\nelse puts n\n\tcountdown(n-1)\nend\n\nend",
"def sum(num)\n num.zero? ? num : num + sum(num - 1)\nend",
"def bunny(n)\n # base case\n return 0 if n == 0\n # recursive case\n return 2 + bunny(n-1)\nend",
"def recursion(x)\n return \"HEYO!\" if x >= 5\n puts x\n recursion(x += 1)\nend",
"def sum_to(n)\n # if n < 2\n # 1\n # else\n # n + sum_to(n-1)\n # end\n return 1 if n < 2\n n + sum_to(n - 1)\nend",
"def zeros(n)\n if n.zero? == true\n puts \"the number is zero\"\n return n\n else\n factrl = (1..n).inject(:*)\n factrl = factrl.to_s.chars.map(&:to_i)\n\n count = 0\n count2 = 0\n ft = factrl.each do |ft|\n count2 += ft\n end\n\n puts count2\n if count2 >= 1\n factrl.reverse_each do |fact|\n break if count2.zero?\n if fact.to_i == 0\n count += 1\n elsif fact.to_i > 0\n break\n end\n end\n end\n end\n\n return count\nend",
"def sum(n)\n return 1 if n == 1\n\n n + sum(n - 1)\nend",
"def rec_sum(num)\n return num if num <= 1\n num + rec_sum(num - 1)\nend",
"def factorial_recursive(n)\n n.zero? ? 1 : n * factorial_recursive(n - 1)\nend",
"def bunny(n)\n # base case\n return 0 if n == 0\n # recursive case\n return 2 + bunny(n - 1)\nend",
"def mystery(n)\n 0\nend",
"def factorial(number)\n if number == 1 # <-- BASE CASE: scenario that tells recusion when to stop\n return 1\n else\n number * factorial(number - 1) # <-- RULE: determines when recursion should continue\n end\nend",
"def factorial num\n # Guard clause\n return 0 if num === 0\n num === 1 ? 1 : num * factorial( num - 1 )\nend",
"def recursion(number)\n if number == 1\n return number\n else\n p number\n recursion(number - 1)\n end\nend",
"def factorial (integer)\n if integer == 0\n return 1\n else\n integer * factorial(integer-1)\n end\nend",
"def rec_sum(n)\n if n == 0\n return 0\n else\n return n + rec_sum(n-1)\n end\nend",
"def factorial_recursive(n)\n\tif n == 0\n\t\treturn 1 # 0! = 1\n\telse\n\t\treturn n*factorial_recursive(n-1) #keep calling the function\n\tend\nend",
"def factorial(no)\n return no if no == 1\n no = no * factorial(no - 1)\nend",
"def factorial(number)\n # Your code goes here\n if number == 0\n 1\n else\n number * factorial(number-1)\n end\nend",
"def count_node(node, counter)\n return counter if node.tail?\n count_node(node.next_node, counter += 1)\nend",
"def bottles(num)\n puts 'No more bottles of coke on the wall' if num.zero?\n\n if num.positive?\n puts \"#{num} bottles of coke on the wall\"\n bottles(num - 1)\n end\nend",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 0 if n == 0\n return 2 + bunny(n - 1)\n\nend",
"def countdown(n=10)\n if n == 0 # Base case\n puts \"Blastoff\"\n else\n puts n\n sleep 1\n countdown n - 1 # Recursion, step to move closer to the base case\n end\nend",
"def factorial_recursive(n)\n return 1 if n == 0\n n * factorial_recursive(n-1)\nend",
"def factorial(num)\n return 1 if num == 1\n num * factorial(num - 1)\nend",
"def factorial_recursive(num = 0)\n # this is a guard clause\n return \"Can not calculate factorial of a negative number\" if num < 0\n\n if num <= 1\n 1 # this is our base case\n else\n num * factorial_recursive(num - 1) # this is where the recursion happens\n end\nend",
"def sum_to(n)\n return nil if n < 0\n return 0 if n == 0\n n + sum_to(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def fibonacci(num)\n raise ArgumentError if num < 0\n return 0 if num == 0\n helper(0, 1, num-1)\nend",
"def factorial_recursive(num)\n if num == 0\n 1\n else \n num * factorial_recursive(num-1)\n \n # 7 * 6 = 42\n # 42 * 5 = 210\n # 210 * 4 = 840\n # 840 * 3 = 2520\n # 2520 *2 = 5040\n # 5040* 1 = 5040\n end\nend",
"def bunny(n) \n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def no_boring_zeros(num)\nreturn 0 if num == 0\n\n new_num = num.to_s\n if new_num[-1] == \"0\"\n no_boring_zeros(new_num[0..-2])\n else\n return new_num.to_i\n end\nend",
"def sum_to(n)\n return nil if n < 1\n return 1 if n == 1\n\n n + sum_to(n - 1) \nend",
"def f(n)\n return n if n.zero? || n == 1\n f(n - 1) + f(n - 2)\nend",
"def count_end_zeros\n return 1 if zero?\n (self % 5).zero? ? 1 + (self / 5).count_end_zeros : 0\n end",
"def factorial(num)\n if num == 0\n 1\n else\n num * factorial(num - 1)\n end\nend",
"def bunny(n)\n\n return 0 if n == 0\n return 2 if n == 1\n bunny(n - 1) + 2\n\nend",
"def factorial(n)\n return 1 if n == 0\n n * factorial(n - 1)\nend"
] | [
"0.81870455",
"0.81870455",
"0.81870455",
"0.81870455",
"0.81870455",
"0.81870455",
"0.81268746",
"0.78934944",
"0.7727996",
"0.7626371",
"0.7538814",
"0.74868375",
"0.74338186",
"0.7396636",
"0.73881465",
"0.72799397",
"0.7129322",
"0.7128008",
"0.7058029",
"0.7024019",
"0.6956636",
"0.69098043",
"0.6909137",
"0.6896933",
"0.68904865",
"0.68904865",
"0.68904865",
"0.6887048",
"0.6882277",
"0.6879659",
"0.6872218",
"0.6866149",
"0.6856484",
"0.68439347",
"0.6839851",
"0.6828573",
"0.6828573",
"0.67986935",
"0.6792711",
"0.6787327",
"0.6784665",
"0.67647415",
"0.6692071",
"0.6680806",
"0.6679498",
"0.6642539",
"0.6612502",
"0.6593263",
"0.65808433",
"0.6571431",
"0.6551368",
"0.65204966",
"0.64954907",
"0.6482399",
"0.64469963",
"0.64469963",
"0.6435224",
"0.6426964",
"0.6410618",
"0.6408341",
"0.6403538",
"0.6360739",
"0.6351793",
"0.6341542",
"0.6335304",
"0.6333638",
"0.63229865",
"0.63145465",
"0.6305791",
"0.63054097",
"0.63052046",
"0.6286217",
"0.627799",
"0.6267531",
"0.6253585",
"0.6249728",
"0.6246083",
"0.622327",
"0.62218875",
"0.62186474",
"0.6217435",
"0.62170094",
"0.6212072",
"0.6210217",
"0.62055373",
"0.6201391",
"0.61998576",
"0.61998576",
"0.61998576",
"0.6195918",
"0.61942154",
"0.61852044",
"0.61844516",
"0.61838263",
"0.6182917",
"0.61779225",
"0.6175772",
"0.61753744",
"0.6172892"
] | 0.68926483 | 25 |
Previous to which includes this backfill, the stream_docket_number and stream_type fields were not used. Therefore, nothing needs to happen in order to rollback the migration. | def down; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback\n # implement in subclasses\n end",
"def rollback\n sanity_check\n @handle.rollback\n end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback\n end",
"def rollback_db_transaction() \n log('Rolling back boxcar', 'rollback_db_transaction()')\n @command_boxcar = []\n end",
"def rollback\n each {|transition| transition.machine.write(object, :event, transition.event)}\n super\n end",
"def rollback\n super\n each { |transition| transition.machine.write(object, :event, transition.event) unless transition.transient? }\n end",
"def rollback()\n #This is a stub, used for indexing\n end",
"def rollback!\n restore_attributes\n end",
"def rollback\n @db.rollback\n end",
"def rollback\n true\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def rollback\n @MySQLConnection.query('rollback')\n end",
"def rollback\n each { |transition| transition.rollback }\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def rollback!\n self.revert_to! self.previous_version\n end",
"def rollback\n self.revert_to self.previous_version\n end",
"def rollback\n IBM_DB.rollback(@conn)\n end",
"def rollback\n each {|transition| transition.rollback}\n end",
"def rollback_db_transaction\n log('rollback transaction', nil) { @connection.rollback }\n end",
"def rollback(step = 1)\n files = File.migrated.reverse.first(step)\n Migrate::Down.new(files).perform\n end",
"def rollback_db_transaction\n @transaction = @connection.rollback\n end",
"def rollback\n query 'rollback'\n self\n end",
"def rollback\n Rails.logger.debug \"Rollback not implemented: #{self.class.to_s}\"\n end",
"def rollback_transaction_sql\n SQL_ROLLBACK\n end",
"def rollback_transaction_sql\n SQL_ROLLBACK\n end",
"def up\n ActiveRecord::Base.transaction do\n migrate_cause\n migrate_messages\n end\n end",
"def close_stream source # :nodoc:\n @drb_streams.delete source\n @incomplete_streams.delete source\n @incomplete_timestamps.delete source\n end",
"def rollback(database, step = 1)\n ensure_schema_migrations_table_exists(database)\n Database.process(database) do\n ActiveRecord::Migrator.rollback(migration_paths(database), step)\n end\n dump_schema(database)\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def upgrade_model_storage(repository, model)\n add_sequences(repository, model)\n super\n end",
"def rollback!\n ActiveRecord::Base.transaction do\n CSV.foreach(filename, headers: HEADERS, return_headers: false) do |row|\n User.where(id: row['user_id']).update_all(encrypted_otp_secret: row['old_value'])\n end\n end\n end",
"def up!\n swap_with(previous) unless first?\n end",
"def rollback\n @repo.rollback\n end",
"def rollback\n raise TransactionRollback.new\n end",
"def rollback\n @original_squares.each do |square|\n @board.set_at(square[:coords], square[:piece])\n end\n end",
"def down\n ActiveRecord::Base.record_timestamps = false\n\n # Parse and modify the data in memory, because the JSON to modify is stored as a string in the database\n UserExportPreset.all.in_batches do |batch|\n batch.each do |uep|\n config = JSON.parse(uep.config)\n if config.dig('data', 'patients', 'query', 'workflow') == 'global'\n config['data']['patients']['query']['workflow'] = 'all'\n uep.update!(config: config.to_json)\n end\n end\n end\n\n ActiveRecord::Base.record_timestamps = true\n end",
"def reset_stream_statistics\n super\n end",
"def reset!\n migrate_table!(:down)\n migrate_table!(:up)\n disconnect\n end",
"def rollback opts = {}\n update opts.merge(:data => xml.rollback)\n end",
"def rollback\n { rollback: {} }.to_json\n end",
"def renew\n @stream.drop if params.fetch(:force_drop, false)\n success(streams: @stream.api_model_data_create)\n end",
"def apply\n migration.up\n end",
"def rollback\n objects.clear\n load\n finish_transaction\n end",
"def ensure_deletion_fixes \n # TO DO\n end",
"def down\n\t\tchange_column :products, :tag, :integer\n\tend",
"def rollback\n raise \"Illegal state for rollback: #{@state}\" unless @state == :begin\n each_adapter(:rollback_adapter_if_begin, [:rollback_and_close_adapter_if_begin, :close_adapter_if_none])\n each_adapter(:rollback_prepared_adapter_if_prepare, [:rollback_prepared_and_close_adapter_if_begin, :close_adapter_if_none])\n each_adapter(:close_adapter_if_open, [:log_fatal_transaction_breakage])\n @state = :rollback\n end",
"def down\n rename_column :items,:auction_end, :bid_time\n end",
"def do_backed_up\n self.update_attributes(:needs_initial_scan => false)\n update_last_backup_times\n end",
"def rollback_transaction(tx)\n # nothing to do\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def rollback!\n files.each { |file, contents| rollback_file(file, contents) }\n @files = {}\n end",
"def disconnect_connection(conn)\n conn.RollbackTrans rescue nil\n super\n end",
"def payload_for_reverted\n super\n end",
"def initialize up_stream\n super(up_stream)\n end",
"def rollback(database, step = 1)\n Tenant.switch(database) do\n if activerecord_below_5_2?\n ActiveRecord::Migrator.rollback(ActiveRecord::Migrator.migrations_paths, step)\n else\n ActiveRecord::Base.connection.migration_context.rollback(step)\n end\n end\n end",
"def rollback_changes(podspecFile, info)\n\n\t\t\t\tsave_podspec(podspecFile, info.original_spec)\n\t\t\t\toldspec = old_filename()\n\t\t\t\tFile.delete(oldspec) if File.exist?(oldspec)\n\n\t\t\t\tgit_commit_push(\"reverting back from #{info.versionString()}\")\n\t\t\t\tgit_tag_delete(\"#{info.versionString()}\")\n\t\t\tend",
"def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end",
"def drop( number )\n\n load_parent_state\n \n return super\n\n end",
"def rollback!\n if (@status == 'DELETED')\n self.errors.add(:base, 'Campaign is already deleted.')\n return false\n end\n\n self.errors.clear\n\n self.update(\n :name => \"#{@name}_DELETED_#{(Time.now.to_f * 1000).to_i}\",\n :status => 'DELETED'\n )\n end",
"def rollback()\n rollback_to_release = releases[-2]\n\n if rollback_to_release.nil?\n server[:logger].warn('No release to rollback to')\n else\n current_release_dir = release_dir(releases.last)\n skip_current_release_dir = release_dir(\"skip-#{releases.last}\")\n cmd.ssh(\"mv #{current_release_dir} #{skip_current_release_dir}\")\n symlink_release_dir(rollback_to_release)\n end\n end",
"def rollback_transaction(conn)\n log_info(TRANSACTION_ROLLBACK)\n conn.rollback\n end",
"def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end",
"def rollback_transaction?\n false\n end",
"def rollback_savepoint_sql(depth)\n SQL_ROLLBACK_TO_SAVEPOINT % depth\n end",
"def rollback transaction\n service.rollback project_id: project, database_id: database, transaction: transaction\n end",
"def up\r\n Shout.all.each do |shout|\r\n text_subject = TextSubject.create(body: shout.body)\r\n\r\n shout.subject_id = text_subject.id\r\n shout.subject_type = \"TextSubject\"\r\n shout.save\r\n end\r\n\r\n remove_column :shouts, :body\r\n\r\n change_column_null :shouts, :subject_id, false\r\n change_column_null :shouts, :subject_type, false\r\n end",
"def rollback_transaction(tx)\n tx.rollback\n end",
"def table(table, stream)\n return if already_dumped?(table)\n\n new_stream = StringIO.new\n super(table, new_stream)\n string = new_stream.string\n\n if (parent_table = @connection.parent_table(table))\n table(parent_table, stream)\n string = inject_inherits_for_create_table(string, table, parent_table)\n string = remove_parent_table_columns(string, @connection.columns(parent_table))\n\n pindexes = Hash[@connection.indexes(parent_table).map { |index| [index.columns, index] }]\n cindexes = Hash[@connection.indexes(table).map { |index| [index.columns, index] }]\n\n string = remove_parent_table_indexes(string, (pindexes & cindexes).values)\n end\n\n # We've done this table\n dumped_tables << table\n\n stream.write string\n stream\n end",
"def rollback()\n oldpos = @checkpoints.pop\n unless oldpos\n oldpos = 0\n end\n self.pos = oldpos\n return self \n end",
"def rollback_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n log_connection_yield('Transaction.rollback_savepoint', conn){conn.rollback(savepoint_obj(conn))}\n else\n log_connection_yield('Transaction.rollback', conn){conn.rollback}\n end\n end",
"def destroy\n transaction do\n if self.old_version\n self.old_version.update_column :new_version_id, nil\n end\n super\n end\n end",
"def up\n # Use self.class:: so constants are resolved in subclasses instead of this class.\n self.class::COLUMNS.each do |column|\n change_column_null(self.class::TABLE_NAME, column, false)\n end\n end",
"def wipe_snapshots_data; end",
"def wipe_snapshots_data; end",
"def post_transaction_process\n fail(ActiveRecord::Rollback) unless @status\n end",
"def migration\n end",
"def upgrade\n fail ProtocolError unless @stream_id == 1\n send_connection_preface\n new_stream(state: :half_closed_local)\n end",
"def rollback_configuration\n data[:rollback_configuration]\n end",
"def reset_migrations!\n @migrations = nil\n @migrate_to = nil\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = nil\n end\n end",
"def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end",
"def rollback_to_seed_data\n File.open(@database_config_path, \"w\") do |file|\n file.puts @original_database_config\n end\nend",
"def rollback\n current_transaction.rollback\n last_transaction = @all_transactions.pop\n end",
"def undo\n fan.medium\n end",
"def undo\n fan.medium\n end",
"def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end",
"def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end",
"def restore\n self.update_column(:deleted_at, nil)\n end",
"def revert\n end",
"def rollback\n puts colorBlue('rolling back to commit blah')\n end",
"def rollback_item\n ingreso_producto = self.ingreso_producto\n ingreso_producto.cantidad = ingreso_producto.cantidad + self.cantidad\n ingreso_producto.producto.stock = ingreso_producto.producto.stock + self.cantidad #suma al stock si se anula\n Lineakardex.create(:kardex => ingreso_producto.producto.kardex, :tipo => \"Entrada\", :fecha => Time.now, :cantidad => self.cantidad, :v_unitario => self.ingreso_producto.producto.precio_venta, :modulo => \"Hospitalizacion\", :observaciones => \"Pedido Anulado\" )\n ingreso_producto.save\n ingreso_producto.producto.save\n end",
"def revert_database\n ActiveRecord::Base.establish_connection(default_connection)\n end",
"def rollback\n without_transactions do\n repository.transactions_log.delete_if do |(method, options)|\n\n begin\n case method\n when :ingest\n repository.purge_object :pid => options[:pid]\n\n when :modify_object\n repository.modify_object options\n\n when :add_datastream\n repository.purge_datastream :pid => options[:pid], :dsid => options[:dsid]\n\n when :add_relationship\n repository.purge_relationship options[:options].merge(:pid => options[:pid])\n\n when :purge_relationship\n repository.add_relationship options[:options].merge(:pid => options[:pid])\n\n when :purge_object\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n\n when :set_datastream_options\n repository.set_datastream_options options\n\n when :modify_datastream\n repository.purge_object :pid => options[:pid] rescue nil\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n\n when :purge_datastream\n repository.purge_object :pid => options[:pid] rescue nil\n repository.ingest :pid => options[:pid], :file => options[:foxml]\n end\n rescue\n # no-op\n end\n\n run_hook :after_rollback, :pid => options[:pid], :method => method, :options => options\n\n end\n end\n true\n end",
"def down\n change_column :feeds, :prompt, :string\n end"
] | [
"0.5815248",
"0.5786877",
"0.57542306",
"0.57542306",
"0.57542306",
"0.57542306",
"0.57542306",
"0.57022387",
"0.56881833",
"0.5636266",
"0.5596204",
"0.5565521",
"0.54744583",
"0.54385257",
"0.5401416",
"0.53434366",
"0.53434366",
"0.5139939",
"0.512766",
"0.51097804",
"0.51097804",
"0.51007175",
"0.50965476",
"0.50944096",
"0.50881404",
"0.5085457",
"0.50782776",
"0.50728923",
"0.5065766",
"0.5061826",
"0.50602794",
"0.50602794",
"0.50168324",
"0.50026226",
"0.49690717",
"0.49582183",
"0.4918678",
"0.49099147",
"0.49060997",
"0.48709297",
"0.48369288",
"0.48305014",
"0.4827301",
"0.48256427",
"0.47681803",
"0.4763613",
"0.47599676",
"0.4730813",
"0.47283792",
"0.47269413",
"0.46888152",
"0.4685883",
"0.4673645",
"0.46719223",
"0.46683922",
"0.46448082",
"0.4643558",
"0.4643558",
"0.46420118",
"0.46037552",
"0.45920864",
"0.45901734",
"0.458676",
"0.45849487",
"0.45843562",
"0.4581446",
"0.4573724",
"0.45717105",
"0.4559308",
"0.4556817",
"0.4533958",
"0.45259768",
"0.4515903",
"0.45089704",
"0.4508167",
"0.45065135",
"0.45007595",
"0.44969833",
"0.44936872",
"0.4491596",
"0.44822508",
"0.44822508",
"0.448203",
"0.44797862",
"0.44721645",
"0.44673422",
"0.44641575",
"0.44634727",
"0.44611353",
"0.44540387",
"0.44488776",
"0.44488776",
"0.44354516",
"0.44354516",
"0.4429554",
"0.4417677",
"0.4398055",
"0.43967816",
"0.43873385",
"0.4387182",
"0.43823552"
] | 0.0 | -1 |
GET /closedcashes GET /closedcashes.json | def index
@closedcashes = Closedcash.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coches = Coche.all\n end",
"def index\n @chests = Chest.all\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @commits = Commits.all(params[:branche_id])\n\n respond_to do |format|\n format.json { render json: @commits, status: 200 }\n end\n end",
"def show\n begin\n @course = Course.find(params[:id])\n raise if @course.nil?\n \n conditions = [\"course_id = ?\",@course.id]\n @holes = Hole.find(:all, :conditions => conditions)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def destroy\n @closedcash.destroy\n respond_to do |format|\n format.html { redirect_to closedcashes_url, notice: 'Closedcash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def contracts\n\t\t@user = User.find_by_username(params[:profile_id])\n\t\tif [email protected]?\n\t\t\tredirect_to root_path\n\t\tend\n\n\t\tcontracts = []\n\t\tif current_admin.present? || (current_user.meets_contract_preferences?(@user) && [email protected]_blocking_user?(current_user))\n\t\t\t(@user.posted_contracts.where(status: \"Open\") + @user.posted_bounties.where(status: \"Open\")).each do | c |\n\t\t\t\tcontracts << {\n\t\t\t\t\t:id => c.id,\n\t\t\t\t\t:start=> c.start_date_time,\n\t\t\t\t\t:end=> c.end_date_time,\n\t\t\t\t\t:title=> \"$#{c.price_in_dollars}\",\n\t\t\t\t\t:type => c.contract_type\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\t\trender :json => contracts\n\tend",
"def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend",
"def candles(sym='btcusd', options={})\n #Hashie::Mash.new(\n #self.class.get(\"/v1/candles/#{sym}\", options).parsed_response\n nil\n end",
"def check_for_closed_incidents\n incidents.where(status: 'Closed').each(&:check_closed_at_time)\n end",
"def get_closed_tickets( session_key, company_id, page_size, page_num)\n response_xml = self.call( :get_closed_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: page_size,\n arg3: page_num\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @users = User.where(:listed => 1)\n if current_closed_challenge.present?\n @entries = Entry.where(:challenge_id => current_closed_challenge.id).limit(3)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Entry.all }\n end\n else\n respond_to do |format|\n format.html { render \"challenges/about\" }\n format.json { render json: Entry.all }\n end\n end\n end",
"def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end",
"def index\n @cofs = Cof.all\n end",
"def closed_goggle_cup\n unless ( params[:id] ) && GoggleCup.exists?( params[:id].to_i )\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_back( fallback_location: root_path ) and return\n end\n\n # Gets closed goggle cup\n @closed_goggle_cup = GoggleCup.find( params[:id].to_i )\n @team = @closed_goggle_cup.team.decorate if @closed_goggle_cup\n\n\n @tab_title = @closed_goggle_cup.get_full_name\n\n # Gets goggle cup ranks\n @closed_goggle_cup_rank = @closed_goggle_cup ? @closed_goggle_cup.calculate_goggle_cup_rank : []\n end",
"def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def index\n @open_hours = OpenHour.all\n end",
"def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end",
"def index\n @criticals = Critical.all\n end",
"def opening\n fetch('chess.openings')\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end",
"def closed\n @exercises = current_company.exercises.closed\n flash[:notice] = t('flash.actions.index.notice') if @exercises.empty?\n respond_with(@exercises) do |format|\n format.html { render :action => :index }\n end\n end",
"def index\n render json: @chapter.reposoitories, status: :ok\n end",
"def new\n @cash = @organism.cashes.new\n @cash.sector_id = @organism.sectors.first.id unless @organism.sectored?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cash }\n end\n end",
"def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end",
"def index\n @congties = Congty.all\n end",
"def index\n @admin_cashes = Admin::Cash.all\n end",
"def ohlc(id, currency: 'usd', days: 7, **options)\n get \"coins/#{id}/ohlc\", vs_currency: currency, days: days, **options\n end",
"def index\n @paymentcashes = Paymentcash.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paymentcashes }\n end\n end",
"def index\n @clochers = Clocher.all\n end",
"def index\n @bull_put_spreads = current_user.bull_put_spreads.open.order(:expiration)\n @closed = current_user.bull_put_spreads.closed\n end",
"def get_oclcs(member_id, hdfn, conn)\n hdf = Hathidata::Data.new(hdfn);\n\n if hdf.exists? then\n $log.i(\"#{hdf.path} already exists, skipping method #{__method__}.\");\n return hdf.path;\n elsif hdf.backup? then\n $log.i(\"Backup of #{overlapf.path} already exists. Skipping method #{__method__}.\");\n return hdf.path;\n end\n\n hdf.open('w');\n sql = \"SELECT DISTINCT oclc FROM holdings_memberitem WHERE member_id = ?\";\n sth = conn.prepare(sql);\n\n $log.d(sql.sub('?', member_id));\n\n count_lines = 0;\n sth.query(member_id) do |row|\n hdf.file.puts row['oclc'];\n count_lines += 1;\n if count_lines % 100000 == 0 then \n $log.d(\"#{count_lines} oclcs output\");\n end\n end\n hdf.close();\n\n return hdf.path;\nend",
"def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end",
"def index\n @court_halls = CourtHall.all\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def github_closed_issues(user, repo, milestone)\n issues = Github::Client::Issues.new(user: user, repo: repo)\n mid = github_milestone_for(issues, user, repo, milestone)\n\n return nil if mid == -1\n\n options = { user: user, repo: repo, milestone: mid.to_s, state: 'closed', per_page: 100 }\n\n full_list = []\n 1.upto(1_000_000) do |i|\n options[:page] = i\n page = issues.list(options).map do |issue|\n ['#' + issue.number.to_s, issue.title, issue.html_url]\n end\n return full_list if page.size == 0\n full_list.concat page\n end\n full_list\nend",
"def closed\n @projects = Project.closed(true).paginate(:page => params[:page])\n @final = true\n \n respond_to do |format|\n format.html # closed.html.erb\n end\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def index\n @cash_collections = CashCollection.all\n end",
"def index\n @periods = @organism.periods.order(:close_date)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periods } \n end\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def destroy\n @closing_cash.destroy\n respond_to do |format|\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def closed_lists\n List.closed(id)\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def index\n @truck_cashes = TruckCash.all\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def closed_goggle_cup\n # --- \"Closed Goggle cup\" tab (not shown): ---\n unless ( params[:goggle_cup_id] ) && GoggleCup.exists?( params[:goggle_cup_id].to_i )\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_back( fallback_location: root_path ) and return\n end\n\n @tab_title = I18n.t('radiography.goggle_cup_closed')\n\n @goggle_cups = []\n @goggle_cups << GoggleCup.find( params[:goggle_cup_id].to_i )\n end",
"def get_closed_seasons\n @closed_seasons ||= retrieve_closed_seasons\n end",
"def index\n #@cashflows = Cashflow.all\n @cashflows = Cashflow.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cashflows }\n end\n end",
"def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closing_day }\n end\n end",
"def all\n challenges = Challenge.all(@oauth_token, params[:open], \n params[:technology] ||= nil, \n params[:platform] ||= nil, \n params[:category] ||= nil, \n enforce_order_by_params(params[:order_by], 'end_date__c'),\n params[:limit] ||= 50,\n params[:offset] ||= 0)\n # merge in the topcoder challenges\n Topcoder.challenges_open.each {|c| challenges << c } if params[:include_tc]\n expose challenges\n end",
"def index\n @property_closets = PropertyCloset.all\n end",
"def index\n @leaf = Leaf.find(params[:leaf_id])\n @contracts = @leaf.contracts.all\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end",
"def index\n @cys_envs = CysEnv.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cys_envs }\n end\n end",
"def index\n @socio_cpfs = SocioCpf.all\n end",
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def committees(options = {})\n get('/committees', options)\n end",
"def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n lat = request.headers['lat'].to_f\n long = request.headers['long'].to_f\n\n @user = User.find(current_user)\n @concerts = @user.artists.map do |a|\n a.concerts.select{|c| Date.parse(c.date) > Date.today && Date.parse(c.date) < (Date.today + 7)}\n end\n @concerts = @concerts.flatten.sort do |concert1, concert2|\n order = Date.parse(concert1.date) <=> Date.parse(concert2.date)\n if order != 0\n order\n else\n concert1.distance(lat, long) <=> concert2.distance(lat, long)\n end\n end\n render json: {concerts: @concerts}\n end",
"def index\n @clins = Clin.all\n end",
"def index\n @climbing_routes = ClimbingRoute.all\n end",
"def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def index\n @calves = Calf.all\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def index\n @coutlines = Coutline.all\n end",
"def index\n @couts = Cout.order(:code)\n @company = Company.find(1)\n end",
"def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end",
"def index\n conditions = { :client_id => @client.id }\n if params[\"tags\"]\n conditions.merge!({:tags => params[\"tags\"]})\n end\n\n @collections = Collection.where(conditions).order('updated_at DESC')\n @collections.reject! { |item| ! item.read?(@user, @client) }\n\n entries = Array.new\n if @collections\n @collections.each do |item|\n entries << item.info_hash(@user, @client)\n end\n end\n render_json :entry => entries and return\n end",
"def index\n @slots = Slot.opening_hours.where(:company_id => current_user.company.id)\n @slots = @slots.sort { |a, b| a.cwday <=> b.cwday }\n\n @blockers = Slot.blockers.where(:company_id => current_user.company.id)\n @blockers = @blockers.sort { |a, b| a.cwday <=> b.cwday }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { slots: @slots, blockers: @blockers } }\n end\n end",
"def index\n get_contracts\n end",
"def index\n @complaint_client_satisfactions = ComplaintClientSatisfaction.all\n end",
"def get_contracts\n response = @client.get(contracts_link)\n raise Inkdit::Error.new(response) unless response.status == 200\n\n response.parsed['resources'].map do |contract_params|\n Contract.new @client, contract_params\n end\n end",
"def index\n @cages = current_user.cages\n\n respond_to do |format|\n format.json { render json: @cages }\n end\n end",
"def index\n @circuses = Circus.all\n end",
"def index\n @contract_doc_categories = ContractDocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contract_doc_categories }\n end\n end",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end",
"def index\n @cousins = Cousin.all\n end",
"def index\n @casos = Caso.all\n end",
"def show\n @cocktail_history = CocktailHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail_history }\n end\n end",
"def index\n\t\t@clubs = Club.all\n\t\trender json: @clubs\n\tend",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end"
] | [
"0.5741302",
"0.55803186",
"0.5531151",
"0.5511623",
"0.54670066",
"0.5443565",
"0.54336494",
"0.53780437",
"0.5341276",
"0.5333986",
"0.53330994",
"0.5326586",
"0.53065556",
"0.5298249",
"0.5252971",
"0.52351236",
"0.5230586",
"0.52280295",
"0.5227345",
"0.5222473",
"0.5219588",
"0.5216092",
"0.5214467",
"0.52137995",
"0.51962954",
"0.5186015",
"0.51840717",
"0.51712334",
"0.5165799",
"0.51607347",
"0.5157233",
"0.51553494",
"0.5125749",
"0.5103155",
"0.5097688",
"0.5089836",
"0.5088651",
"0.5078849",
"0.5073207",
"0.5057532",
"0.5038956",
"0.5029124",
"0.5026952",
"0.50206375",
"0.50129414",
"0.5006694",
"0.50054777",
"0.5001633",
"0.49985364",
"0.49964872",
"0.49873874",
"0.49862036",
"0.49779278",
"0.49754784",
"0.49650624",
"0.49507913",
"0.4946432",
"0.49392462",
"0.4936042",
"0.4929627",
"0.49285108",
"0.4923469",
"0.49212438",
"0.4919371",
"0.491484",
"0.4913979",
"0.4911298",
"0.49033454",
"0.49016556",
"0.4898331",
"0.4881626",
"0.48814887",
"0.4880522",
"0.48755658",
"0.4868564",
"0.48648506",
"0.48605528",
"0.4854914",
"0.48545587",
"0.4854269",
"0.48542652",
"0.48535183",
"0.48529932",
"0.48528334",
"0.48441064",
"0.48350492",
"0.4828255",
"0.48267242",
"0.48263043",
"0.48193735",
"0.48192",
"0.481694",
"0.48126018",
"0.4810918",
"0.4809802",
"0.48074356",
"0.48068568",
"0.48049378",
"0.4802974",
"0.480244"
] | 0.7033928 | 0 |
GET /closedcashes/1 GET /closedcashes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @closedcashes = Closedcash.all\n end",
"def index\n @coches = Coche.all\n end",
"def new\n @cash = @organism.cashes.new\n @cash.sector_id = @organism.sectors.first.id unless @organism.sectored?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cash }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def show\n begin\n @course = Course.find(params[:id])\n raise if @course.nil?\n \n conditions = [\"course_id = ?\",@course.id]\n @holes = Hole.find(:all, :conditions => conditions)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @commits = Commits.all(params[:branche_id])\n\n respond_to do |format|\n format.json { render json: @commits, status: 200 }\n end\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end",
"def index\n @chests = Chest.all\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end",
"def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @cocktail_history = CocktailHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail_history }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n render json: @chapter.reposoitories, status: :ok\n end",
"def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closing_day }\n end\n end",
"def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end",
"def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def index\n @cofs = Cof.all\n end",
"def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end",
"def show\n @cycdatum = Cycdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cycdatum }\n end\n end",
"def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend",
"def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def show\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golf_cource }\n end\n end",
"def destroy\n @closedcash.destroy\n respond_to do |format|\n format.html { redirect_to closedcashes_url, notice: 'Closedcash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @paymentcashes = Paymentcash.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paymentcashes }\n end\n end",
"def index\n @critical_factors = CriticalFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_factors }\n end\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def show\n @cashflow = Cashflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cashflow }\n end\n end",
"def closed_goggle_cup\n unless ( params[:id] ) && GoggleCup.exists?( params[:id].to_i )\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_back( fallback_location: root_path ) and return\n end\n\n # Gets closed goggle cup\n @closed_goggle_cup = GoggleCup.find( params[:id].to_i )\n @team = @closed_goggle_cup.team.decorate if @closed_goggle_cup\n\n\n @tab_title = @closed_goggle_cup.get_full_name\n\n # Gets goggle cup ranks\n @closed_goggle_cup_rank = @closed_goggle_cup ? @closed_goggle_cup.calculate_goggle_cup_rank : []\n end",
"def index\n @criticals = Critical.all\n end",
"def ohlc(id, currency: 'usd', days: 7, **options)\n get \"coins/#{id}/ohlc\", vs_currency: currency, days: days, **options\n end",
"def show\n @clowd = Clowd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clowd }\n end\n end",
"def candles(sym='btcusd', options={})\n #Hashie::Mash.new(\n #self.class.get(\"/v1/candles/#{sym}\", options).parsed_response\n nil\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end",
"def get_oclcs(member_id, hdfn, conn)\n hdf = Hathidata::Data.new(hdfn);\n\n if hdf.exists? then\n $log.i(\"#{hdf.path} already exists, skipping method #{__method__}.\");\n return hdf.path;\n elsif hdf.backup? then\n $log.i(\"Backup of #{overlapf.path} already exists. Skipping method #{__method__}.\");\n return hdf.path;\n end\n\n hdf.open('w');\n sql = \"SELECT DISTINCT oclc FROM holdings_memberitem WHERE member_id = ?\";\n sth = conn.prepare(sql);\n\n $log.d(sql.sub('?', member_id));\n\n count_lines = 0;\n sth.query(member_id) do |row|\n hdf.file.puts row['oclc'];\n count_lines += 1;\n if count_lines % 100000 == 0 then \n $log.d(\"#{count_lines} oclcs output\");\n end\n end\n hdf.close();\n\n return hdf.path;\nend",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_compliance }\n end\n end",
"def index\n @users = User.where(:listed => 1)\n if current_closed_challenge.present?\n @entries = Entry.where(:challenge_id => current_closed_challenge.id).limit(3)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Entry.all }\n end\n else\n respond_to do |format|\n format.html { render \"challenges/about\" }\n format.json { render json: Entry.all }\n end\n end\n end",
"def contracts\n\t\t@user = User.find_by_username(params[:profile_id])\n\t\tif [email protected]?\n\t\t\tredirect_to root_path\n\t\tend\n\n\t\tcontracts = []\n\t\tif current_admin.present? || (current_user.meets_contract_preferences?(@user) && [email protected]_blocking_user?(current_user))\n\t\t\t(@user.posted_contracts.where(status: \"Open\") + @user.posted_bounties.where(status: \"Open\")).each do | c |\n\t\t\t\tcontracts << {\n\t\t\t\t\t:id => c.id,\n\t\t\t\t\t:start=> c.start_date_time,\n\t\t\t\t\t:end=> c.end_date_time,\n\t\t\t\t\t:title=> \"$#{c.price_in_dollars}\",\n\t\t\t\t\t:type => c.contract_type\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\t\trender :json => contracts\n\tend",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @congties = Congty.all\n end",
"def index\n @periods = @organism.periods.order(:close_date)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periods } \n end\n end",
"def show\n @climb_datum = ClimbDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb_datum }\n end\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def new\n @schedule = Schedule.new\n @client_branches = ClientBranch.where(:client_id => 0)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end",
"def index\n @admin_cashes = Admin::Cash.all\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end",
"def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end",
"def index\n @calves = Calf.all\n end",
"def index\n @cloth_measures = ClothMeasure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cloth_measures }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n @client_branches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @circuses = Circus.all\n end",
"def fetch_cdi_value\n token = get_financial_data_token\n if token\n\t\t\tactual_date = \"#{Date.current.year}-#{Date.current.month}-#{Date.current.day}\"\n\t\t\tif Cdi.all.count > 0\n\t\t\t\tlast_cdi_date = Cdi.last.date_tax + 1\n\t\t\telse\n\t\t\t\tlast_cdi_date = '2010-01-01'\n\t\t\tend\n uri = URI.parse(\"https://api.financialdata.io/v1/indices/CDI/serie?dataInicio=#{last_cdi_date}&dataFim=#{actual_date}\")\n header = {'Content-Type': 'application/json', 'Authorization': \"Bearer #{token}\"}\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri, header)\n response = http.request(request)\n return JSON.parse(response.read_body) \n end\n end",
"def show\n render json: @course, status: :found\n end",
"def index\n @open_hours = OpenHour.all\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def show\n @coverage = Coverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coverage }\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end",
"def index\n @clochers = Clocher.all\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract }\n end\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def index\n @socio_cpfs = SocioCpf.all\n end",
"def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end",
"def index\n get_contracts\n end",
"def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end",
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def index\n @couts = Cout.order(:code)\n @company = Company.find(1)\n end",
"def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end",
"def show\n @close_type = CloseType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @close_type }\n end\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def index\n @cash_collections = CashCollection.all\n end",
"def index\n @leaf = Leaf.find(params[:leaf_id])\n @contracts = @leaf.contracts.all\n end",
"def index\n @clins = Clin.all\n end",
"def index\n @contract_doc_categories = ContractDocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contract_doc_categories }\n end\n end",
"def index\n #@cashflows = Cashflow.all\n @cashflows = Cashflow.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cashflows }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def index\n @cys_envs = CysEnv.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cys_envs }\n end\n end",
"def show\n @cyclist = Cyclist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cyclist }\n end\n end",
"def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end"
] | [
"0.695236",
"0.58905417",
"0.5885187",
"0.5879806",
"0.5788413",
"0.573673",
"0.5724047",
"0.56487846",
"0.56402886",
"0.5605486",
"0.55878794",
"0.5578086",
"0.55562705",
"0.550434",
"0.54925424",
"0.54818404",
"0.54640764",
"0.5457379",
"0.5454219",
"0.5450022",
"0.5441552",
"0.5439774",
"0.5439515",
"0.54375464",
"0.54317033",
"0.5428754",
"0.54254127",
"0.541022",
"0.5393651",
"0.53921676",
"0.5390109",
"0.538911",
"0.53876483",
"0.53865474",
"0.53865474",
"0.5383151",
"0.53774136",
"0.53679395",
"0.5353795",
"0.5351445",
"0.5346902",
"0.5336731",
"0.53326094",
"0.5324196",
"0.53114057",
"0.5310064",
"0.53091514",
"0.5305337",
"0.5301978",
"0.53007",
"0.5299747",
"0.5275964",
"0.52740496",
"0.5272517",
"0.52696234",
"0.5258741",
"0.5253837",
"0.5248518",
"0.52364963",
"0.5224626",
"0.5213534",
"0.5213534",
"0.5210587",
"0.5209531",
"0.52083904",
"0.52036524",
"0.51987374",
"0.51967746",
"0.518799",
"0.51816916",
"0.5180203",
"0.51760954",
"0.5165288",
"0.5165187",
"0.516185",
"0.5159004",
"0.51567245",
"0.514606",
"0.51421297",
"0.5140482",
"0.5139345",
"0.51376355",
"0.513754",
"0.51344264",
"0.5128125",
"0.5127056",
"0.5127001",
"0.5120349",
"0.511987",
"0.511667",
"0.511635",
"0.51155984",
"0.51139176",
"0.51122785",
"0.5110282",
"0.51100254",
"0.51087224",
"0.5106031",
"0.5101268",
"0.50991404",
"0.50990593"
] | 0.0 | -1 |
POST /closedcashes POST /closedcashes.json | def create
@closedcash = Closedcash.new(closedcash_params)
respond_to do |format|
if @closedcash.save
format.html { redirect_to @closedcash, notice: 'Closedcash was successfully created.' }
format.json { render :show, status: :created, location: @closedcash }
else
format.html { render :new }
format.json { render json: @closedcash.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @closedcashes = Closedcash.all\n end",
"def destroy\n @closedcash.destroy\n respond_to do |format|\n format.html { redirect_to closedcashes_url, notice: 'Closedcash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @cash = @organism.cashes.new\n @cash.sector_id = @organism.sectors.first.id unless @organism.sectored?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cash }\n end\n end",
"def create\n @closing_cash = ClosingCash.new(closing_cash_params)\n apertura = OpeningCash.find(@closing_cash.opening_cash.id)\n empleado = Employee.find(apertura.employee.id)\n caja = Cash.find(apertura.cash.id)\n respond_to do |format|\n if @closing_cash.save\n apertura.estado = \"finalizado\"\n apertura.save\n empleado.estado = \"Libre\"\n empleado.save\n caja.estado = \"Cerrada\"\n caja.save\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully created.' }\n format.json { render :show, status: :created, location: @closing_cash }\n else\n format.html { render :new }\n format.json { render json: @closing_cash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @closing_cash.destroy\n respond_to do |format|\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def close\n @ticket.update_attributes(status: \"Closed\")\n redirect_to tickets_path\n end",
"def create\n @chemical = Chemical.new(chemical_params)\n if @chemical.save!\n render json: @chemical\n else\n render json: {errors: @chemical.errors.full_messages}\n end\n end",
"def create\n @cash_collection = CashCollection.new(cash_collection_params)\n\n respond_to do |format|\n if @cash_collection.save\n format.html { redirect_to @cash_collection, notice: 'Cash collection was successfully created.' }\n format.json { render :show, status: :created, location: @cash_collection }\n else\n format.html { render :new }\n format.json { render json: @cash_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def create\n @chest = Chest.new(chest_params)\n\n respond_to do |format|\n if @chest.save\n format.html { redirect_to @chest, notice: 'Chest was successfully created.' }\n format.json { render :show, status: :created, location: @chest }\n else\n format.html { render :new }\n format.json { render json: @chest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @critical = Critical.new(critical_params)\n\n respond_to do |format|\n if @critical.save\n format.html { redirect_to @critical, notice: 'Critical was successfully created.' }\n format.json { render :show, status: :created, location: @critical }\n else\n format.html { render :new }\n format.json { render json: @critical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def closedcash_params\n params.require(:closedcash).permit(:money, :host, :hostsequence)\n end",
"def mark_close\n respond_to do |format|\n if @ticket.update({status: Ticket::STATUS[:closed]})\n format.html { redirect_to @ticket, notice: 'Ticket was successfully marked as close.' }\n format.json { render json: {status: :ok}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend",
"def create\n @climb = Climb.new(params[:climb])\n respond_to do |format|\n if @climb.save\n Sesh.find(params[:sesh_id]).climbs << @climb\n format.html { redirect_to @climb.sesh, notice: 'Climb was successfully created.' }\n format.json { render json: @climb.sesh.data.to_json, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @climb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @closing_day = ClosingDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closing_day }\n end\n end",
"def create\n @closing_day = ClosingDay.new(params[:closing_day])\n\n respond_to do |format|\n if @closing_day.save\n format.html { redirect_to @closing_day, notice: 'Closing day was successfully created.' }\n format.json { render json: @closing_day, status: :created, location: @closing_day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @closing_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_for_closed_incidents\n incidents.where(status: 'Closed').each(&:check_closed_at_time)\n end",
"def create\n @clearing_house = ClearingHouse.new(clearing_house_params)\n\n respond_to do |format|\n if @clearing_house.save\n format.html { flash[:success] = 'Clearing house was successfully created.'; redirect_to @clearing_house }\n format.json { render :show, status: :created, location: @clearing_house }\n else\n format.html { render :new }\n format.json { render json: @clearing_house.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def close\n authorize @assignment\n @assignment.close_date = Date.today\n close_status = $current_community.assignment_status_close\n if not close_status.nil? then \n @assignment.assignment_status_id = close_status.id\n end\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: t(:assignment_closed) }\n format.json { render :show, status: :ok, location: @assignment }\n else\n format.html { redirect_to @assignment, notice: t(:assignment_not_closed) }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cash_flow ||= @monthly_budget.cash_flows.build(\n category_id: @category.id\n )\n\n @cash_flow.planned = cash_flow_params[:planned]\n\n if @cash_flow.save\n render json: @cash_flow, status: :created\n else\n render json: @cash_flow.errors, status: :unprocessable_entity\n end\n end",
"def closed_goggle_cup\n # --- \"Closed Goggle cup\" tab (not shown): ---\n unless ( params[:goggle_cup_id] ) && GoggleCup.exists?( params[:goggle_cup_id].to_i )\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_back( fallback_location: root_path ) and return\n end\n\n @tab_title = I18n.t('radiography.goggle_cup_closed')\n\n @goggle_cups = []\n @goggle_cups << GoggleCup.find( params[:goggle_cup_id].to_i )\n end",
"def new\n @closed_group = ClosedGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closed_group }\n end\n end",
"def create\n @cash = @organism.cashes.new(params[:cash])\n\n respond_to do |format|\n if @cash.save\n format.html { redirect_to admin_organism_cashes_url(@organism), notice: 'La caisse a été créée' }\n format.json { render json: @cash, status: :created, location: @cash }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coche = Coche.new(coche_params)\n\n respond_to do |format|\n if @coche.save\n format.html { redirect_to @coche, notice: 'Coche was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coche }\n else\n format.html { render action: 'new' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hopen = Hopen.new(hopen_params)\n\n respond_to do |format|\n if @hopen.save\n format.html { redirect_to @hopen, notice: 'Hopen was successfully created.' }\n format.json { render :show, status: :created, location: @hopen }\n else\n format.html { render :new }\n format.json { render json: @hopen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_closedcash\n @closedcash = Closedcash.find(params[:id])\n end",
"def closed_goggle_cup\n unless ( params[:id] ) && GoggleCup.exists?( params[:id].to_i )\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_back( fallback_location: root_path ) and return\n end\n\n # Gets closed goggle cup\n @closed_goggle_cup = GoggleCup.find( params[:id].to_i )\n @team = @closed_goggle_cup.team.decorate if @closed_goggle_cup\n\n\n @tab_title = @closed_goggle_cup.get_full_name\n\n # Gets goggle cup ranks\n @closed_goggle_cup_rank = @closed_goggle_cup ? @closed_goggle_cup.calculate_goggle_cup_rank : []\n end",
"def create\n @condolence = Condolence.new(params[:condolence])\n @orbituarysite = @condolence.orbituarysite\n respond_to do |format|\n if @condolence.save\n format.html { redirect_to @orbituarysite, notice: 'Condolence was successfully created.' }\n format.json { render json: @condolence, status: :created, location: @condolence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @condolence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @closedcash.update(closedcash_params)\n format.html { redirect_to @closedcash, notice: 'Closedcash was successfully updated.' }\n format.json { render :show, status: :ok, location: @closedcash }\n else\n format.html { render :edit }\n format.json { render json: @closedcash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def has_closed_cases\n unless current_user.lawfirm.cases.where(open: false).exists?\n redirect_to new_closed_case_path,\n :flash => {:danger => \"You must fill out or upload information of a closed case to view.\"}\n end\n end",
"def new\n @schedule = Schedule.new\n @client_branches = ClientBranch.where(:client_id => 0)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end",
"def create\n @climb_datum = ClimbDatum.new(params[:climb_datum])\n\n respond_to do |format|\n if @climb_datum.save\n format.html { redirect_to @climb_datum, notice: 'Climb datum was successfully created.' }\n format.json { render json: @climb_datum, status: :created, location: @climb_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @climb_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @chest.destroy\n respond_to do |format|\n format.html { redirect_to chests_url, notice: 'Chest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def prepare_close_tickets(vulnerability_list, site_id)\n fail 'Ticket closures are only supported in default mode.' if @options[:ticket_mode] == 'I'\n @log.log_message('Preparing ticket closures by default method.')\n @nxid = nil\n tickets = []\n CSV.parse(vulnerability_list.chomp, headers: :first_row) do |row|\n case @options[:ticket_mode]\n # 'D' Default mode: IP *-* Vulnerability\n when 'D'\n @nxid = \"#{site_id}#{row['asset_id']}#{row['vulnerability_id']}#{row['solution_id']}\"\n # 'I' IP address mode: IP address -* Vulnerability\n when 'I'\n @nxid = \"#{site_id}#{row['current_ip']}\"\n # 'V' Vulnerability mode: Vulnerability -* IP address\n# when 'V'\n# @NXID = \"#{site_id}#{row['current_asset_id']}#{row['current_vuln_id']}\"\n else\n fail 'Could not close tickets - do not understand the ticketing mode!'\n end\n workorderid = find_ticket_in_database(@nxid)\n # Query ServiceDesk for the incident by unique id (generated NXID)\n if workorderid.nil? || workorderid.empty?\n @log.log_message(\"No workorderid found for NXID #{@nxid}\")\n else\n tickets << { :action => :close, :nxid => @nxid, :workorderid => workorderid,\n :description => closeTicketRequest() }\n end\n end\n return tickets\n end",
"def create\n @cutoff = Cutoff.new(cutoff_params)\n\n respond_to do |format|\n if @cutoff.save\n format.html { redirect_to @cutoff, notice: 'Cutoff was successfully created.' }\n format.json { render :show, status: :created, location: @cutoff }\n else\n format.html { render :new }\n format.json { render json: @cutoff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @closeinf = Closeinf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closeinf }\n end\n end",
"def closed\n @exercises = current_company.exercises.closed\n flash[:notice] = t('flash.actions.index.notice') if @exercises.empty?\n respond_with(@exercises) do |format|\n format.html { render :action => :index }\n end\n end",
"def destroy\n @cash.destroy\n respond_to do |format|\n format.html { redirect_to cashes_url, notice: 'Cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def closing_cash_params\n params.require(:closing_cash).permit(:fecha_cierre, :monto_efectivo, :monto_cheque, :monto_tcredito, :monto_tdebito,:existente_efe,:existente_cheque,:existente_tcre,:existente_tdb,:opening_cash_id,:dif_registrada,:dif_efectivo,:dif_cheque,:dif_credito,:dif_debito)\n end",
"def destroy\n @cash_collection.destroy\n respond_to do |format|\n format.html { redirect_to cash_collections_url, notice: 'Cash collection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @closing_item = ClosingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closing_item }\n end\n end",
"def create\n @chemical = Chemical.new(chemical_params)\n\n respond_to do |format|\n if @chemical.save\n format.html { redirect_to @chemical, notice: 'Chemical was successfully created.' }\n format.json { render :show, status: :created, location: @chemical }\n else\n format.html { render :new }\n format.json { render json: @chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso was successfully created.' }\n format.json { render :show, status: :created, location: @caso }\n else\n format.html { render :new }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cond = Orbituarysite.find(params[:id]) \n @condolence = @cond.condolences.new\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @condolence }\n end\n end",
"def create\n @total_closing = TotalClosing.new(total_closing_params)\n\n respond_to do |format|\n if @total_closing.save\n format.html { redirect_to @total_closing, notice: 'Total closing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @total_closing }\n else\n format.html { render action: 'new' }\n format.json { render json: @total_closing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cycdatum = Cycdatum.new(params[:cycdatum])\n\n respond_to do |format|\n if @cycdatum.save\n format.html { redirect_to @cycdatum, notice: 'Cycdatum was successfully created.' }\n format.json { render json: @cycdatum, status: :created, location: @cycdatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cycdatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def closement_params\n params.require(:closement).permit(:close_day)\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def destroy\n @closed_group = ClosedGroup.find(params[:id])\n @closed_group.destroy\n\n respond_to do |format|\n format.html { redirect_to closed_groups_url }\n format.json { head :no_content }\n end\n end",
"def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end",
"def new\n @climb_datum = ClimbDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @climb_datum }\n end\n end",
"def new\n @cage = Cage.find(params[:cage_id])\n\n @entrance = @cage.entrances.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entrance }\n end\n end",
"def create\n @coutline = Coutline.new(coutline_params)\n\n respond_to do |format|\n if @coutline.save\n format.html { redirect_to @coutline, notice: 'Coutline was successfully created.' }\n format.json { render :show, status: :created, location: @coutline }\n else\n format.html { render :new }\n format.json { render json: @coutline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @cocktail = Cocktail.new(params[:cocktail])\n @cocktail.prise = 20000\n @cocktail.grade = 0\n @cocktail.oficial = false\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully created.' }\n format.json { render :json => @cocktail, :status => :created, :location => @cocktail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @dish = @cafeteria.dishes.new(dish_params)\n\n respond_to do |format|\n if @dish.save\n format.html { redirect_to @cafeteria, notice: 'El plato se ha creado.' }\n format.json { render :show, status: :created, location: @dish }\n else\n format.html { redirect_to @cafeteria, alert: 'No se pudo crear el plato.' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @total_closing.destroy\n respond_to do |format|\n format.html { redirect_to total_closings_url }\n format.json { head :no_content }\n end\n end",
"def create\n @cashflow = Cashflow.new(cashflow_params)\n\n respond_to do |format|\n if @cashflow.save\n format.html { redirect_to @cashflow, notice: 'Cashflow was successfully created.' }\n format.json { render :show, status: :created, location: @cashflow }\n else\n format.html { render :new }\n format.json { render json: @cashflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @hopen.destroy\n respond_to do |format|\n format.html { redirect_to hopens_url, notice: 'Hopen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @chests = Chest.all\n end",
"def create\n @compromise = Compromise.new(params[:compromise])\n\n respond_to do |format|\n if @compromise.save\n format.html { redirect_to @compromise, notice: 'Compromise was successfully created.' }\n format.json { render json: @compromise, status: :created, location: @compromise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @closing_statement = ClosingStatement.new(closing_statement_params)\n\n respond_to do |format|\n if @closing_statement.save\n format.html { redirect_to @closing_statement.debate notice: 'closing statement was successfully created.' }\n format.json { render :show, status: :created, location: @closing_statement }\n else\n format.html { render :new }\n format.json { render json: @closing_statement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cheque = Cheque.new(params[:cheque])\n\n respond_to do |format|\n if @cheque.save\n format.html { redirect_to @cheque, notice: 'Cheque was successfully created.' }\n format.json { render json: @cheque, status: :created, location: @cheque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end",
"def create\n @cof = Cof.new(cof_params)\n\n respond_to do |format|\n if @cof.save\n format.html { redirect_to @cof, notice: 'Cof was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cof }\n else\n format.html { render action: 'new' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cheque = Cheque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cheque }\n end\n end",
"def destroy\n @cn_curve.destroy\n respond_to do |format|\n format.html { redirect_to cn_curves_url }\n format.json { head :no_content }\n end\n end",
"def new\n @clowd = Clowd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clowd }\n end\n end",
"def create\n @scheduled_chore = ScheduledChore.new(scheduled_chore_params)\n\n respond_to do |format|\n if @scheduled_chore.save\n format.html { redirect_to @scheduled_chore, notice: 'Scheduled chore created.' }\n format.json { render :show, status: :created, location: @scheduled_chore }\n else\n format.html { render :new }\n format.json { render json: @scheduled_chore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @cutoff.destroy\n respond_to do |format|\n format.html { redirect_to cutoffs_url, notice: 'Cutoff was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @chemical_substance = ChemicalSubstance.new(chemical_substance_params)\n\n respond_to do |format|\n if @chemical_substance.save\n format.html { redirect_to @chemical_substance, notice: 'Sustancia Quimica fue creada de forma exitosa.' }\n format.json { render :show, status: :created, location: @chemical_substance }\n else\n format.html { render :new }\n format.json { render json: @chemical_substance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @commits = Commits.all(params[:branche_id])\n\n respond_to do |format|\n format.json { render json: @commits, status: 200 }\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @caso = Caso.new(caso_params)\n\n respond_to do |format|\n if @caso.save\n format.html { redirect_to @caso, notice: 'Caso creado con éxito.' }\n format.json { render action: 'show', status: :created, location: @caso }\n else\n format.html { render action: 'new' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stock_disposal = StockDisposal.new(params[:stock_disposal])\n if @stock_disposal.save\n redirect_to(edit_stock_disposal_path(@stock_disposal), :notice => 'Stock disposal was successfully created.')\n else\n render :action => \"new\"\n end\n end",
"def new\n @cycdatum = Cycdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cycdatum }\n end\n end",
"def closed\n @projects = Project.closed(true).paginate(:page => params[:page])\n @final = true\n \n respond_to do |format|\n format.html # closed.html.erb\n end\n end",
"def create\n @incident = Incident.new(incident_params)\n @incident.happened_at = Time.now\n @incident.state = :open\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @historic_refinancing.destroy\n respond_to do |format|\n format.html { redirect_to historic_refinancings_url, notice: 'Historic refinancing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @court_hall.destroy\n respond_to do |format|\n format.html { redirect_to court_halls_url, notice: 'Court hall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_closed_tickets( session_key, company_id, page_size, page_num)\n response_xml = self.call( :get_closed_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: page_size,\n arg3: page_num\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def index\n @coches = Coche.all\n end",
"def new\n @critical_factor = CriticalFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critical_factor }\n end\n end",
"def destroy\n @property_interior_closure.destroy\n respond_to do |format|\n format.html { redirect_to property_interior_closures_url, notice: 'Property interior closure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critical.destroy\n respond_to do |format|\n format.html { redirect_to criticals_url, notice: 'Critical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @exterior_closure = ExteriorClosure.new(exterior_closure_params)\n\n respond_to do |format|\n if @exterior_closure.save\n format.html { redirect_to @exterior_closure, notice: 'Exterior closure was successfully created.' }\n format.json { render :show, status: :created, location: @exterior_closure }\n else\n format.html { render :new }\n format.json { render json: @exterior_closure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def close\n @job = Job.find(params[:id])\n @job.status = \"closed\"\n @job.save\n\n\t\tflash[:notice] = 'Job Proposal is now closed.'\n\n respond_to do |format|\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cheque.destroy\n respond_to do |format|\n format.html { redirect_to cheques_url }\n format.json { head :no_content }\n end\n end",
"def new\n @casualcomment = Casualcomment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casualcomment }\n end\n end",
"def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def create\n @cheque = Cheque.new(cheque_params)\n\n respond_to do |format|\n if @cheque.save\n format.html { redirect_to @cheque, notice: 'Cheque was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cheque }\n else\n format.html { render action: 'new' }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @golf_cource = GolfCource.new(params[:golf_cource])\n\n respond_to do |format|\n if @golf_cource.save\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully created.' }\n format.json { render json: @golf_cource, status: :created, location: @golf_cource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schedule = Schedule.new(params[:schedule])\n @client_branches = ClientBranch.where(:client_id => @schedule.client_id)\n respond_to do |format|\n if @schedule.save\n @schedule.update_attributes(:branch_id => @schedule.client_branch.branch_id, :company_id => @schedule.client_branch.company_id)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @climbing_route = ClimbingRoute.new(climbing_route_params)\n\n respond_to do |format|\n if @climbing_route.save\n format.html { redirect_to @climbing_route, notice: 'Climbing route was successfully created.' }\n format.json { render :show, status: :created, location: @climbing_route }\n else\n format.html { render :new }\n format.json { render json: @climbing_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def open\n respond_to do |format|\n @scrachpad.update_attributes(:is_opened=> true);\n format.json { head :no_content }\n end\n end",
"def destroy\n @clowd = Clowd.find(params[:id])\n @clowd.destroy\n\n respond_to do |format|\n format.html { redirect_to clowds_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.59366107",
"0.5625707",
"0.54568887",
"0.5336653",
"0.5164702",
"0.50557494",
"0.49656606",
"0.49523142",
"0.4887954",
"0.48670718",
"0.48529908",
"0.48406962",
"0.4782424",
"0.47802147",
"0.4777653",
"0.47656786",
"0.4758427",
"0.47494102",
"0.4748986",
"0.47237813",
"0.47210857",
"0.47119045",
"0.4706769",
"0.4705445",
"0.46829566",
"0.46728155",
"0.467252",
"0.46585733",
"0.46502075",
"0.46387455",
"0.46309194",
"0.4629591",
"0.46283638",
"0.46260956",
"0.46229625",
"0.46075538",
"0.46062586",
"0.46042207",
"0.459237",
"0.45737222",
"0.45515227",
"0.45502922",
"0.45500124",
"0.45494658",
"0.4545624",
"0.45287728",
"0.45230988",
"0.45065555",
"0.45006222",
"0.44979715",
"0.4490194",
"0.44888034",
"0.44867352",
"0.44867066",
"0.4477662",
"0.44737944",
"0.4472851",
"0.4468766",
"0.44665605",
"0.4464442",
"0.44543812",
"0.44530416",
"0.44521868",
"0.4443588",
"0.44398314",
"0.44355598",
"0.44294527",
"0.4428529",
"0.4425273",
"0.44206625",
"0.4413919",
"0.44136804",
"0.44070002",
"0.4405952",
"0.44048104",
"0.44045892",
"0.43990022",
"0.43974185",
"0.43967453",
"0.439349",
"0.43933415",
"0.43925077",
"0.43922228",
"0.43912664",
"0.4388904",
"0.43888488",
"0.4385177",
"0.43785554",
"0.43741184",
"0.43719622",
"0.43677512",
"0.43630764",
"0.43622616",
"0.43622506",
"0.43610132",
"0.4360407",
"0.4359268",
"0.4357277",
"0.4357015",
"0.4356227"
] | 0.5829651 | 1 |
PATCH/PUT /closedcashes/1 PATCH/PUT /closedcashes/1.json | def update
respond_to do |format|
if @closedcash.update(closedcash_params)
format.html { redirect_to @closedcash, notice: 'Closedcash was successfully updated.' }
format.json { render :show, status: :ok, location: @closedcash }
else
format.html { render :edit }
format.json { render json: @closedcash.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cash = @organism.cashes.find(params[:id])\n\n respond_to do |format|\n if @cash.update_attributes(params[:cash])\n format.html { redirect_to admin_organism_cashes_url(@organism), notice: 'La caisse a été modifiée.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cof.update(cof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { render :show, status: :ok, location: @caso }\n else\n format.html { render :edit }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @chemical.update(chemical_params)\n format.html { redirect_to @chemical, notice: 'Chemical was successfully updated.' }\n format.json { render :show, status: :ok, location: @chemical }\n else\n format.html { render :edit }\n format.json { render json: @chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @regular_chemical.update(regular_chemical_params)\n format.html { redirect_to mol_front_index_path, notice: 'Regular chemical was successfully updated.' }\n format.json { render :show, status: :ok, location: @regular_chemical }\n else\n format.html { render :edit }\n format.json { render json: @regular_chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @critical.update(critical_params)\n format.html { redirect_to @critical, notice: 'Critical was successfully updated.' }\n format.json { render :show, status: :ok, location: @critical }\n else\n format.html { render :edit }\n format.json { render json: @critical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n if @clue.update_attributes(params[:clue])\n format.html { redirect_to @clue, notice: 'Clue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cash_collection.update(cash_collection_params)\n format.html { redirect_to @cash_collection, notice: 'Cash collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @cash_collection }\n else\n format.html { render :edit }\n format.json { render json: @cash_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @circular.update(circular_params)\n format.html { redirect_to @circular, notice: 'Circular was successfully updated.' }\n format.json { render :show, status: :ok, location: @circular }\n else\n format.html { render :edit }\n format.json { render json: @circular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @scheduled_chore.update(scheduled_chore_params)\n format.html { redirect_to @scheduled_chore, notice: 'Scheduled chore updated.' }\n format.json { render :show, status: :ok, location: @scheduled_chore }\n else\n format.html { render :edit }\n format.json { render json: @scheduled_chore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chemical_substance.update(chemical_substance_params)\n format.html { redirect_to @chemical_substance, notice: 'Sustancia Quimica fue actualizado de forma exitosa.' }\n format.json { render :show, status: :ok, location: @chemical_substance }\n else\n format.html { render :edit }\n format.json { render json: @chemical_substance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @closing_cash.update(closing_cash_params)\n format.html { redirect_to @closing_cash, notice: 'Closing cash was successfully updated.' }\n format.json { render :show, status: :ok, location: @closing_cash }\n else\n format.html { render :edit }\n format.json { render json: @closing_cash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n @client_branches = ClientBranch.where(:client_id => params[:schedule][:client_id])\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cocktail = Cocktail.find(params[:id])\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crate.update(crate_params)\n format.html { redirect_to tenant_crates_path(@tenant), notice: 'Crate was successfully updated.' }\n format.json { render :show, status: :ok, location: @crate }\n else\n format.html { render :edit }\n format.json { render json: @crate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, notice: 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cocktail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cash = @organism.cashes.new\n @cash.sector_id = @organism.sectors.first.id unless @organism.sectored?\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cash }\n end\n end",
"def update\n respond_to do |format|\n if @cashbox.update(cashbox_params)\n format.html { redirect_to @cashbox, notice: 'Cashbox was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cashbox.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @cage.update_attributes(params[:cage])\n format.json { head :no_content }\n else\n format.json { render json: @cage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\nlogger.debug \"update discipline: \"[email protected]\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @chest.update(chest_params)\n format.html { redirect_to @chest, notice: 'Chest was successfully updated.' }\n format.json { render :show, status: :ok, location: @chest }\n else\n format.html { render :edit }\n format.json { render json: @chest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_cpf.update(socio_cpf_params)\n format.html { redirect_to @socio_cpf, notice: 'Socio cpf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_cpf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:commit] == 'Accept'\n params[:scoot][:state] = 'accepted'\n else\n params[:scoot][:state] = 'rejected'\n end\n respond_to do |format|\n if @scoot.update(scoot_params)\n format.html { redirect_to root_url, notice: 'Scoot was successfully updated.' }\n format.json { render :show, status: :ok, location: @scoot }\n else\n format.html { render :edit }\n format.json { render json: @scoot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @small_concert.update(small_concert_params)\n format.html { redirect_to '/admin/small_concerts', notice: 'Small concert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @small_concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cut = Cut.find(params[:id])\n\n respond_to do |format|\n if @cut.update_attributes(params[:cut])\n format.html {render :template => 'shared/close', :layout => \"fancybox\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cut.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @solidarity.update(solidarity_params)\n format.html { redirect_to @solidarity, notice: 'Solidarity was successfully updated.' }\n format.json { render :show, status: :ok, location: @solidarity }\n else\n format.html { render :edit }\n format.json { render json: @solidarity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @climb_datum = ClimbDatum.find(params[:id])\n\n respond_to do |format|\n if @climb_datum.update_attributes(params[:climb_datum])\n format.html { redirect_to @climb_datum, notice: 'Climb datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @climb_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n if @factoid.update_attributes(params[:factoid])\n format.html { redirect_to @factoid, notice: 'Factoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factoid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climb.update(climb_params)\n format.html { redirect_to @climb, notice: 'Climb was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb }\n else\n format.html { render :edit }\n format.json { render json: @climb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chocolate.update(chocolate_params)\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @chocolate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cycdatum = Cycdatum.find(params[:id])\n\n respond_to do |format|\n if @cycdatum.update_attributes(params[:cycdatum])\n format.html { redirect_to @cycdatum, notice: 'Cycdatum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cycdatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n if @job_compact.update_attributes(params[:job_compact])\n format.html { redirect_to @job_compact, notice: 'Job compact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_compact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @court_complex.update(court_complex_params)\n format.html { redirect_to @court_complex, notice: 'Court complex was successfully updated.' }\n format.json { render :show, status: :ok, location: @court_complex }\n else\n format.html { render :edit }\n format.json { render json: @court_complex.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hopen.update(hopen_params)\n format.html { redirect_to @hopen, notice: 'Hopen was successfully updated.' }\n format.json { render :show, status: :ok, location: @hopen }\n else\n format.html { render :edit }\n format.json { render json: @hopen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n @cheque = Cheque.find(params[:id])\n\n respond_to do |format|\n if @cheque.update_attributes(params[:cheque])\n format.html { redirect_to @cheque, notice: 'Cheque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mol_biol_chemical.update(mol_biol_chemical_params)\n format.html { redirect_to mol_front_index_path, notice: 'Molecular biology chemical was successfully updated.' }\n format.json { render :show, status: :ok, location: @mol_biol_chemical }\n else\n format.html { render :edit }\n format.json { render json: @mol_biol_chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @cabinet = Cabinet.find(params[:id])\n\n respond_to do |format|\n if @cabinet.update_attributes(params[:cabinet])\n format.html { redirect_to @cabinet, notice: 'Cabinet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cabinet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n if @climb.update_attributes(params[:climb])\n format.html { redirect_to @climb, notice: 'Climb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @climb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_compliance.update_attributes(params[:chiropractic_compliance])\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_compliance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @casualcomment = Casualcomment.find(params[:id])\n\n respond_to do |format|\n if @casualcomment.update_attributes(params[:casualcomment])\n format.html { redirect_to @casualcomment, notice: 'Casualcomment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @casualcomment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @condolence = Condolence.find(params[:id])\n\n respond_to do |format|\n if @condolence.update_attributes(params[:condolence])\n format.html { redirect_to @condolence, notice: 'Condolence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @condolence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n expose Challenge.update(@oauth_token, params[:challenge_id].strip,\n params[:data])\n end",
"def update\n respond_to do |format|\n if @cheque.update(cheque_params)\n format.html { redirect_to @cheque, notice: 'Cheque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cheque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clearing_house.update(clearing_house_params)\n format.html { flash[:success] = 'Clearing house was successfully updated.'; redirect_to @clearing_house }\n format.json { render :show, status: :ok, location: @clearing_house }\n else\n format.html { render :edit }\n format.json { render json: @clearing_house.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climbing_route.update(climbing_route_params)\n format.html { redirect_to @climbing_route, notice: 'Climbing route was successfully updated.' }\n format.json { render :show, status: :ok, location: @climbing_route }\n else\n format.html { render :edit }\n format.json { render json: @climbing_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fascicle.update(fascicle_params)\n format.html { redirect_to @fascicle, notice: 'Fascicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fascicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract.lead, notice: 'Contract was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @companies = Company.all\n respond_to do |format|\n if @house.update(house_params)\n format.html { redirect_to @house, notice: 'House was successfully updated.' }\n format.json { render :show, status: :ok, location: @house }\n else\n format.html { render :edit }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n @clique = Clique.find(params[:id])\n\n respond_to do |format|\n if @clique.update_attributes(params[:clique])\n flash[:notice] = 'Clique was successfully updated.'\n format.html { redirect_to(@clique) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @clique.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clocher.update(clocher_params)\n format.html { redirect_to @clocher, notice: 'Clocher was successfully updated.' }\n format.json { render :show, status: :ok, location: @clocher }\n else\n format.html { render :edit }\n format.json { render json: @clocher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @cabine.update(cabine_params)\n render :show, status: :ok, location: @cabine\n else\n render json: @cabine.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @scoop.update(scoop_params)\n format.html { redirect_to scoops_path, notice: 'Scoop was successfully updated!' }\n format.json { render :show, status: :ok, location: @scoop }\n else\n format.html { render :edit }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cadet.update(cadet_params)\n format.html { redirect_to @cadet, notice: 'Cadet was successfully updated.' }\n format.json { render :show, status: :ok, location: @cadet }\n else\n format.html { render :edit }\n format.json { render json: @cadet.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6029147",
"0.60200167",
"0.5949371",
"0.5945262",
"0.59298706",
"0.5880457",
"0.5873083",
"0.5853828",
"0.5849161",
"0.58354336",
"0.5777488",
"0.57609683",
"0.5758076",
"0.5754664",
"0.5739763",
"0.57173723",
"0.56886303",
"0.5682519",
"0.5682519",
"0.5680539",
"0.56795514",
"0.5678633",
"0.56694674",
"0.56652457",
"0.5653353",
"0.56385964",
"0.5626822",
"0.5619216",
"0.5607265",
"0.5604158",
"0.5603534",
"0.5596258",
"0.55952215",
"0.5594833",
"0.5592476",
"0.558784",
"0.55829173",
"0.5575117",
"0.5571469",
"0.55654585",
"0.555622",
"0.55511475",
"0.5549729",
"0.5548787",
"0.5538209",
"0.55371726",
"0.5535353",
"0.5533182",
"0.5531852",
"0.55254257",
"0.5523825",
"0.55213195",
"0.55161387",
"0.55144876",
"0.55113536",
"0.5502254",
"0.55015904",
"0.55004585",
"0.5498851",
"0.54984725",
"0.5496093",
"0.54927343",
"0.5488492",
"0.5487949",
"0.5486769",
"0.54860383",
"0.5485066",
"0.5480589",
"0.54804546",
"0.54758614",
"0.54757917",
"0.546888",
"0.54603",
"0.54573077",
"0.545667",
"0.54558426",
"0.5444614",
"0.5443877",
"0.544297",
"0.54370964",
"0.54339725",
"0.5433652",
"0.54310936",
"0.54300845",
"0.5426611",
"0.5418739",
"0.54184914",
"0.5415707",
"0.5414666",
"0.5414666",
"0.5414666",
"0.5414666",
"0.5414666",
"0.5414666",
"0.5414666",
"0.5414666",
"0.5414038",
"0.5413415",
"0.5412671",
"0.5412339"
] | 0.6060354 | 0 |
DELETE /closedcashes/1 DELETE /closedcashes/1.json | def destroy
@closedcash.destroy
respond_to do |format|
format.html { redirect_to closedcashes_url, notice: 'Closedcash was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @closing_cash.destroy\n respond_to do |format|\n format.html { redirect_to closing_cashes_url, notice: 'Closing cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caso.destroy\n respond_to do |format|\n format.html { redirect_to casos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ca.destroy\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cash.destroy\n respond_to do |format|\n format.html { redirect_to cashes_url, notice: 'Cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cashflow = Cashflow.find(params[:id])\n @cashflow.destroy\n\n respond_to do |format|\n format.html { redirect_to cashflows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ca = Ca.find(params[:id])\n @ca.destroy\n\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cash_collection.destroy\n respond_to do |format|\n format.html { redirect_to cash_collections_url, notice: 'Cash collection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clowd = Clowd.find(params[:id])\n @clowd.destroy\n\n respond_to do |format|\n format.html { redirect_to clowds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cycdatum = Cycdatum.find(params[:id])\n @cycdatum.destroy\n\n respond_to do |format|\n format.html { redirect_to cycdata_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @csh.destroy\n respond_to do |format|\n format.html { redirect_to cshes_url, notice: 'Csh was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @golf_cource = GolfCource.find(params[:id])\n @golf_cource.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_golf_cources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cof.destroy\n respond_to do |format|\n format.html { redirect_to cofs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_cash.destroy\n respond_to do |format|\n format.html { redirect_to admin_cashes_url, notice: 'Cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format|\n format.html { redirect_to cabinets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cadet = Cadet.find(params[:id])\n @cadet.destroy\n\n respond_to do |format|\n format.html { redirect_to cadets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cfct.destroy\n respond_to do |format|\n format.html { redirect_to cfcts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chemical_substance.destroy\n respond_to do |format|\n format.html { redirect_to chemical_substances_url, notice: 'Sustancia Quimica fue eliminada de forma exitosa.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scheduled_chore.destroy\n respond_to do |format|\n format.html { redirect_to scheduled_chores_url, notice: 'Scheduled chore deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coverage.destroy\n respond_to do |format|\n format.html { redirect_to coverages_url, notice: 'Coverage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cashbox.destroy\n respond_to do |format|\n format.html { redirect_to cashbox_index_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chest.destroy\n respond_to do |format|\n format.html { redirect_to chests_url, notice: 'Chest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caso.destroy\n respond_to do |format|\n format.html { redirect_to casos_url, notice: 'Caso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regular_chemical.destroy\n respond_to do |format|\n format.html { redirect_to regular_chemicals_url, notice: 'Regular chemical was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chemical.destroy\n respond_to do |format|\n format.html { redirect_to chemicals_url, notice: 'Chemical was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critical.destroy\n respond_to do |format|\n format.html { redirect_to criticals_url, notice: 'Critical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @benthic_cover = BenthicCover.find(params[:id])\n @benthic_cover.destroy\n\n respond_to do |format|\n format.html { redirect_to benthic_covers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climb.destroy\n respond_to do |format|\n format.html { redirect_to climbs_url, notice: 'Climb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate.destroy\n respond_to do |format|\n format.html { redirect_to tenant_crates_url, notice: 'Crate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cheque.destroy\n respond_to do |format|\n format.html { redirect_to cheques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occasion.destroy\n respond_to do |format|\n format.html { redirect_to occasions_url, notice: 'Occasion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cfo.destroy\n respond_to do |format|\n format.html { redirect_to cfos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hopen.destroy\n respond_to do |format|\n format.html { redirect_to hopens_url, notice: 'Hopen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @cashflow.destroy\n respond_to do |format|\n format.html { redirect_to cashflows_url, notice: 'Cashflow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coutline.destroy\n respond_to do |format|\n format.html { redirect_to coutlines_url, notice: 'Coutline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n head :no_content\n end",
"def destroy\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n @chiropractic_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to chiropractic_assessments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @casualcomment = Casualcomment.find(params[:id])\n @casualcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to casualcomments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @clique = Clique.find(params[:id])\n @clique.destroy\n\n respond_to do |format|\n format.html { redirect_to(cliques_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cue = Cue.find(params[:id])\n @cue.destroy\n\n respond_to do |format|\n format.html { redirect_to cues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @casa.destroy\n respond_to do |format|\n format.html { redirect_to casas_url, notice: \"Casa was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @squishee_cup = SquisheeCup.find(params[:id])\n @squishee_cup.destroy\n\n respond_to do |format|\n format.html { redirect_to squishee_cups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cocktail_history = CocktailHistory.find(params[:id])\n @cocktail_history.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktail_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clinicalsection = Clinicalsection.find(params[:id])\n @clinicalsection.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicalsections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract.destroy\n respond_to do |format|\n format.html { redirect_to contracts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n @cheque = Cheque.find(params[:id])\n @cheque.destroy\n\n respond_to do |format|\n format.html { redirect_to cheques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mol_biol_chemical.destroy\n respond_to do |format|\n format.html { redirect_to mol_biol_chemicals_url, notice: 'Molecular biology chemical was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_cpf.destroy\n respond_to do |format|\n format.html { redirect_to socio_cpfs_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @clearing_house = ClearingHouse.find(params[:id])\n @clearing_house.destroy\n respond_to do |format|\n format.html { flash[:success] = 'Clearing house was successfully destroyed.'; redirect_to clearing_houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clue = Clue.find(params[:id])\n @clue.destroy\n\n respond_to do |format|\n format.html { redirect_to clues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clue = Clue.find(params[:id])\n @clue.destroy\n\n respond_to do |format|\n format.html { redirect_to clues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cash_dispense = CashDispense.find(params[:id])\n @cash_dispense.destroy\n\n respond_to do |format|\n format.html { redirect_to cash_dispenses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @census_count = CensusCount.find(params[:id])\n @census_count.destroy\n\n respond_to do |format|\n format.html { redirect_to census_counts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climate = Climate.find(params[:id])\n @climate.destroy\n\n respond_to do |format|\n format.html { redirect_to climates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @condolence = Condolence.find(params[:id])\n @condolence.destroy\n @orbituarysite = @condolence.orbituarysite\n\n respond_to do |format|\n format.html { redirect_to @orbituarysite }\n format.json { head :no_content }\n end\n end",
"def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clint.destroy\n respond_to do |format|\n format.html { redirect_to clints_url, notice: 'Clint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @catched.destroy\n respond_to do |format|\n format.html { redirect_to catched_index_url, notice: 'Catched was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @cegonha = Cegonha.find(params[:id])\n @cegonha.destroy\n\n respond_to do |format|\n format.html { redirect_to cegonhas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flow_chapter.destroy\n respond_to do |format|\n format.html { redirect_to flow_chapters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crag.destroy\n respond_to do |format|\n format.html { redirect_to crags_url, notice: 'Crag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @court_hall.destroy\n respond_to do |format|\n format.html { redirect_to court_halls_url, notice: 'Court hall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @crossbow.destroy\n respond_to do |format|\n format.html { redirect_to crossbows_url, notice: 'Crossbow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end"
] | [
"0.69045836",
"0.6696428",
"0.6682799",
"0.66439885",
"0.6625885",
"0.6609741",
"0.6591088",
"0.65908885",
"0.65521854",
"0.65512544",
"0.6545576",
"0.6540615",
"0.65259933",
"0.651811",
"0.6503395",
"0.6501543",
"0.6494892",
"0.648981",
"0.64868647",
"0.6485921",
"0.64812285",
"0.6479018",
"0.6475358",
"0.6429938",
"0.64256567",
"0.6425286",
"0.6424531",
"0.6423687",
"0.64213604",
"0.6416672",
"0.64160407",
"0.6414761",
"0.64113945",
"0.6409217",
"0.6409217",
"0.64014953",
"0.6390855",
"0.637219",
"0.637154",
"0.63582546",
"0.63581944",
"0.635448",
"0.63540155",
"0.63535446",
"0.6335445",
"0.6328093",
"0.63262045",
"0.63249207",
"0.63245034",
"0.6318801",
"0.6314524",
"0.6306844",
"0.6304201",
"0.6302738",
"0.630093",
"0.62989074",
"0.6295434",
"0.62883455",
"0.627495",
"0.6268784",
"0.6266053",
"0.62613493",
"0.626069",
"0.62557083",
"0.62551814",
"0.62535626",
"0.6250792",
"0.625044",
"0.6247774",
"0.62472934",
"0.624412",
"0.624292",
"0.624109",
"0.623787",
"0.623787",
"0.623591",
"0.6233124",
"0.6230328",
"0.6228812",
"0.6228533",
"0.6228164",
"0.6228164",
"0.6227",
"0.62239194",
"0.62222517",
"0.621829",
"0.62167364",
"0.6213239",
"0.62125874",
"0.6209412",
"0.62070715",
"0.6200058",
"0.6199303",
"0.61979145",
"0.61973953",
"0.6197039",
"0.61963546",
"0.6190489",
"0.6190188",
"0.6189945"
] | 0.70740277 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_closedcash
@closedcash = Closedcash.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def _handle_action_missing(*args); end"
] | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865",
"0.53135896",
"0.52999926",
"0.5297309",
"0.5296569",
"0.5261449",
"0.5247048",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52323204",
"0.52310973",
"0.523081",
"0.5225785",
"0.5219039",
"0.52136266",
"0.5208033",
"0.520763",
"0.5177365",
"0.5175224",
"0.5173357",
"0.5166104",
"0.5162502",
"0.51573396",
"0.5154547",
"0.5153531",
"0.51502854",
"0.51436496",
"0.5142863",
"0.51330835",
"0.5115634",
"0.5115634",
"0.511527",
"0.5109693",
"0.51076853",
"0.5093146",
"0.5090683",
"0.50829846",
"0.50819314",
"0.50670373",
"0.5055505",
"0.5053398",
"0.50504035",
"0.50504035",
"0.5037765",
"0.5027292",
"0.5024484",
"0.50150335",
"0.5014069",
"0.50022113",
"0.5001542",
"0.49981874",
"0.49915564",
"0.49915564",
"0.49880967",
"0.4982312",
"0.49787375",
"0.49786067",
"0.49687737",
"0.49676532",
"0.49602765",
"0.49565676",
"0.49550772",
"0.495342",
"0.49522525",
"0.49463704",
"0.49447197",
"0.49362713",
"0.49328062",
"0.49280638",
"0.49272856",
"0.4927058",
"0.49221697",
"0.4919526",
"0.49185994",
"0.49184805",
"0.49170163",
"0.49168405",
"0.49167764"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def closedcash_params
params.require(:closedcash).permit(:money, :host, :hostsequence)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Create a new retriever for the given repository. This class recognizes several options, and subclasses may recognize additional options. Options may never be required. === Options :basedir:: Required, base directory where all files should be retrieved :max_bytes:: Maximum number of bytes to read :max_seconds:: Maximum number of seconds to spend reading :logger:: Logger to use === Parameters repository(RightScraper::Repositories::Base):: repository to scrape options(Hash):: retriever options === Raise 'Missing base directory':: if :basedir option is missing | def initialize(repository, options={})
raise 'Missing base directory' unless options[:basedir]
@repository = repository
@max_bytes = options[:max_bytes] || nil
@max_seconds = options[:max_seconds] || nil
@basedir = options[:basedir]
@repo_dir = RightScraper::Retrievers::Base.repo_dir(@basedir, repository)
unless @logger = options[:logger]
raise ::ArgumentError, ':logger is required'
end
@logger.operation(:initialize, "setting up in #{@repo_dir}") do
::FileUtils.mkdir_p(@repo_dir)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(uri, options = {})\n raise Errors::InvalidURI if invalid_uri?(uri)\n @uri = uri\n @options = DEFAULTS.merge(options)\n raise Errors::InvalidFormat if invalid_format?(@options[:format])\n @repo = nil\n @data = {}\n fetch_repo\n setup_data_hash\n end",
"def initialize options\n if options.has_key? :path\n @reader = Polecat::IndexReader.new(options[:path])\n elsif options.has_key? :reader \n @reader = options[:reader]\n raise ArgumentError, 'no reader' unless @reader.kind_of?(Polecat::IndexReader)\n end\n\n if options.has_key? :default_field\n @default_field = options[:default_field]\n end\n end",
"def initialize(base_dir, repository=nil)\n @base_dir = base_dir.sub(/\\/?\\z/, '/') # guaranteed to have trailing slash\n @repository = repository if repository\n end",
"def initialize(options)\n @git = Git.open(options[:repo])\n @repo_dir = options[:repo]\n @skip_existing = options[:skip_existing]\n @weekly_dir = options[:weeklies]\n end",
"def initialize(options)\n @registry_server = options[:registry_server]\n @repository_name = options[:repository_name]\n\n # these are necessary before using any api calls\n @repository_username = options[:repository_username]\n @repository_password = options[:repository_password]\n end",
"def repository(repo, options = {})\n get Repository.path(repo), options\n end",
"def initialize(path=Dir.pwd, options={})\n @grit = path.kind_of?(Grit::Repo) ? path : Grit::Repo.new(path, options)\n @sandbox = false\n @branch = nil\n @work_dir = path(options[:work_dir] || DEFAULT_WORK_DIR)\n @work_tree = options[:work_tree] || File.join(work_dir, 'tmp', object_id.to_s)\n @index_file = options[:index_file] || File.join(work_dir, 'tmp', \"#{object_id}.index\")\n \n self.author = options[:author] || nil\n self.checkout options[:branch] || DEFAULT_BRANCH\n self.default_blob_mode = options[:default_blob_mode] || DEFAULT_BLOB_MODE\n self.default_tree_mode = options[:default_tree_mode] || DEFAULT_TREE_MODE\n end",
"def initialize(repository, query_options={}, &block)\n @repository = repository\n @query_options = query_options\n super(&block)\n end",
"def initialize(options = {})\n self.base_path = options[:base_path] || Dir.pwd\n self.settings = options[:settings] || load_config\n self.lang = options[:lang] || setting_value(\"settings\", \"default_locale\")\n self.web_path = \"#{options[:web_path]}/\"\n self.indent = options[:indent] || 1\n self.extension = get_extension\n self.filename = options[:filename] || file_name\n self.childs = []\n self.browsers = []\n self.repository = options[:repository]\n self.commit = options[:commit]\n end",
"def initialize(repo, opts={})\n @repo = repo\n end",
"def initialize(options={})\n @temporary = !options.has_key?(:basedir)\n options[:basedir] ||= Dir.mktmpdir\n @logger = ScraperLogger.new\n @options = options.merge({:logger => @logger})\n @resources = []\n end",
"def repository\n @options[:repository]\n end",
"def repository\n @options[:repository]\n end",
"def initialize(options={})\n # Ensure http_proxy env vars are used if no proxy explicitly supplied.\n @options = options\n @http_proxy =\n case @options[:http_proxy]\n when :no_proxy\n false\n when nil\n true\n else\n @options[:http_proxy].to_str\n end\n @fetcher_class = CachedFetcher\n end",
"def initialize(options={})\n @web_client = options.fetch(:http_client)\n @parser = options[:parser] || JSON\n @proxy_factory_class = options[:factory] || ProxyFactory\n @url_encoder = options[:url_encoder] || CGI\n if options.has_key?(:proxy_cache)\n @proxy_cache = options[:proxy_cache]\n else\n @proxy_cache = ProxyCache.new\n end\n\n @metadata = options[:metadata]\n if @metadata\n configure_with_metadata(@metadata)\n else\n @metadata_factory = options[:metadata_factory] || Metadata\n end\n end",
"def setup_fetcher(options={})\n @fetch_base_url = options[:fetch_base_url] || \"\"\n\n @fetch_count=0\n\n\n @record_directory=options[:record_directory]\n @playback_directory=options[:playback_directory]\n\n @throttler=options[:throttler] || Nanikore::Throttler.new(options)\n end",
"def initialize(repository)\n @repository = repository\n end",
"def initialize(options={})\n options.delete_if { |key, value| value.nil? }\n\n resp = get(API_URL, query: options)\n raise exception(\"#{resp.code} #{resp.message}\") unless resp.code.eql?(200)\n\n self.created = resp['created'] if resp.key?('created')\n self.long_url = resp['longUrl']\n self.analytics = resp['analytics'].to_openstruct if resp.key?('analytics')\n self.status = resp['status']\n self.short_url = resp['id']\n end",
"def initialize repo_name, options\n self.repo_name = repo_name\n self.options = options\n end",
"def initialize(repo, opts = {})\n @repo = repo\n opts = DEFAULT_OPTIONS.merge(opts)\n @node, @branch_merge = opts[:node] , opts[:branch_merge]\n @force, @filter = opts[:force], opts[:filter]\n \n initialize_ivars\n end",
"def initialize\n @configuration = RepositoryConfiguration.new\n end",
"def initialize(repository)\n @repository = repository\n end",
"def initialize(args = {})\n @domain = args[:domain]\n\n @get_file_data_timeout = 5\n\n raise ArgumentError, \"you must specify a domain\" unless @domain\n\n if @backend = args[:db_backend]\n @readonly = true\n else\n super\n end\n end",
"def initialize(options = {})\n options = Options.for(options).validate(:logger, :user_agent, :cache_manager, :authenticator, :authenticators, :http_adapter)\n\n @user_agent_tokens = [RESOURCEFUL_USER_AGENT_TOKEN]\n @auth_manager = AuthenticationManager.new()\n\n\n @user_agent_tokens.push(*Array(options.getopt(:user_agent)).flatten.reverse)\n self.logger = options.getopt(:logger) || BitBucketLogger.new\n @cache_manager = options.getopt(:cache_manager) || NullCacheManager.new\n @http_adapter = options.getopt(:http_adapter) || NetHttpAdapter.new\n\n Array(options.getopt([:authenticator, :authenticators])).flatten.each do |an_authenticator|\n add_authenticator(an_authenticator)\n end\n end",
"def repository\n @repository ||= Repository::Content.new(@base_dir)\n end",
"def initialize(path, options = {})\n @gl_admin = Grit::Repo.new(path)\n\n @conf = options[:conf] || CONF\n @confdir = options[:confdir] || CONFDIR\n @keydir = options[:keydir] || KEYDIR\n\n @ssh_keys = load_keys(File.join(path, @keydir))\n @config = Config.new(File.join(path, @confdir, @conf))\n end",
"def initialize(path = nil, options = nil)\n self.path = path\n self.options = options\n self.source = options[:source] if options\n self.source = LaravelRepo if not @source\n end",
"def initialize(path, options = {})\n if path.is_a?(GitAccess)\n options[:access] = path\n path = path.path\n end\n @path = path\n @access = options[:access] || GitAccess.new(path)\n @base_path = options[:base_path] || \"/\"\n @page_class = options[:page_class] || self.class.page_class\n @file_class = options[:file_class] || self.class.file_class\n @markup_class = options[:markup_class] || self.class.markup_class\n @repo = @access.repo\n @sanitization = options[:sanitization] || self.class.sanitization\n @history_sanitization = options[:history_sanitization] || \n self.class.history_sanitization\n end",
"def initialize(repository, source)\n # need this internally to have access to @repository.connection for pulling data\n @repository = repository\n\n @collection = @deposit_url = nil\n @properties = {}\n @accept_packaging = []\n\n @source = source\n\n if source.is_a? REXML::Element # we're most often constructed while parsing service docs\n @deposit_url = source.attributes['href']\n\n source.elements.each do |e|\n case e.name\n when \"acceptPackaging\"\n accept_packaging_rank = e.attributes[\"q\"] ? e.attributes[\"q\"].to_f : 1.0\n @accept_packaging << {'rank' => accept_packaging_rank, 'value' => e.text}\n when \"title\"\n @title = e.text\n else\n @properties[e.name] = e.text\n end\n end\n end\n\n# raise SwordException, \"source provided could not be parsed as ATOM\" if @collection.nil?\n end",
"def initialize(base, url, temp_dir, options)\n @base = base\n @temp_dir = temp_dir\n self.options = options\n @file = File.basename(url)\n @zip_file = @file[/[.]zip$/]\n @file_path = File.join(temp_dir, @file)\n \n # TODO: GET THE FIRST DIRECTORY INSTEAD\n dir_name = @file.gsub(/[.]tar[.]gz$/, '').gsub(/[.]zip$/, '')\n @extracted_path = File.join(temp_dir, dir_name)\n \n @base.say_status 'download and compile', url\n \n download(url)\n extract\n configure unless options[:skip_configure]\n make\n make_install\n end",
"def initialize(options = {})\n @bucket = options[:autocomplete_prefix] || \"\"\n @search_param = options[:search_param] || \"\"\n @constraints = options[:constraint_sets]\n @limit = options[:limit] || 15\n end",
"def initialize(options)\n self.api_key, self.secret_key = options[\"api_key\"], options[\"secret_key\"]\n self.district_number = options[\"district_number\"]\n self.endpoint = options[\"endpoint\"] || TIES::ENDPOINT\n end",
"def initialize(repository = ContractRepository.new)\n @repository = repository\n end",
"def initialize(repository = ContractRepository.new)\n @repository = repository\n end",
"def initialize(**opt)\n opt = opt.dup\n @url = opt.delete(:url) || BASE_URL\n @options = opt\n end",
"def initialize(location, options)\n @location = location\n @origin = options[:origin]\n @repo_name = File.basename location\n @documents = get_repo_files\n @fachklassen_strings = get_fachklassen_strings\n @textbausteine = get_textbausteine\n @enabled = true\n end",
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p workdir\n file = ::File.join(workdir, \"package\")\n\n # TEAL FIX: we have to always-download the tarball before we can\n # determine if contents have changed, but afterward we can compare the\n # previous download against the latest downloaded and short-circuit the\n # remaining flow for the no-difference case.\n @logger.operation(:downloading) do\n credential_command = if @repository.first_credential && @repository.second_credential\n ['-u', \"#{@repository.first_credential}:#{@repository.second_credential}\"]\n else\n []\n end\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = [\n 'curl',\n '--silent', '--show-error', '--location', '--fail',\n '--location-trusted', '-o', file, credential_command,\n @repository.url\n ].flatten\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => workdir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, 'curl', e)\n raise\n end\n end\n\n note_tag(file)\n\n @logger.operation(:unpacking) do\n path = @repository.to_url.path\n if path =~ /\\.gz$/\n extraction = \"xzf\"\n elsif path =~ /\\.bz2$/\n extraction = \"xjf\"\n else\n extraction = \"xf\"\n end\n Dir.chdir(@repo_dir) do\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = ['tar', extraction, file]\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => @repo_dir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, @cmd.first, e)\n raise\n end\n end\n end\n true\n end",
"def scrape(repo, incremental=true, &callback)\n errorlen = errors.size\n repo = RightScraper::Repositories::Base.from_hash(repo) if repo.is_a?(Hash)\n @logger.callback = callback\n begin\n # 1. Retrieve the files\n retriever = nil\n @logger.operation(:retrieving, \"from #{repo}\") do\n retriever = repo.retriever(@options)\n retriever.retrieve if retriever.available?\n end\n\n # 2. Now scrape if there is a scraper in the options\n @logger.operation(:scraping, retriever.repo_dir) do\n if @options[:kind]\n options = @options.merge({:ignorable_paths => retriever.ignorable_paths,\n :repo_dir => retriever.repo_dir,\n :repository => retriever.repository})\n scraper = RightScraper::Scrapers::Base.scraper(options)\n @resources += scraper.scrape\n end\n end\n\n # 3. Cleanup if temporary\n FileUtils.remove_entry_secure(@options[:basedir]) if @temporary\n rescue\n # logger handles communication with the end user and appending\n # to our error list, we just need to keep going.\n end\n @logger.callback = nil\n errors.size == errorlen\n end",
"def initialize(options =\n {\n :type => :GET,\n :base_url => '',\n :api_path => '',\n :headers => {},\n :body => nil,\n :params => {}\n })\n options.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n yield(self) if block_given?\n end",
"def initialize(repository)\n @repository = repository.readonly(true)\n end",
"def initialize(options={})\n @options=options||{}\n @url=options[:url]\n end",
"def initialize(options)\n\t\t\t@options = options\n\t\t\t@driver_name = (options[:driver] || :firefox).to_sym\n\t\t\t@variables = {\n\t\t\t\t'__TIMEOUT__' => (options[:timeout] || 10).to_i,\n\t\t\t\t'__DEBUG__' => false,\n\t\t\t\t'__SELECTOR__' => options[:selector] || 'sid',\n\t\t\t\t'__OUTPUT__' => options[:output],\n\t\t\t\t'__DIR__' => File.absolute_path(Dir.pwd)\n\t\t\t}\n\t\t\t@aliases = {}\n\t\t\t@tests = []\n\n\t\t\tclient = Selenium::WebDriver::Remote::Http::Default.new\n\t\t\tclient.timeout = (@options[:open_timeout] || 60).to_i\n\t\t\t@options[:driver_opt] = {} unless @options[:driver_opt]\n\t\t\t@options[:driver_opt][:http_client] = client\n\n\t\t\t_load_extensions(options[:extensions] || [])\n\n\t\t\t@logger = Context::load_logger(options[:logger], options[:logger_opt])\n\n\t\t\t@parser = Parser.new(self)\n\t\tend",
"def initialize(path)\n super path\n\n @grit_repo = Grit::Repo.new(path)\n end",
"def repo\n options[:repo]\n end",
"def initialize(options)\n # Make a class variable\n @options = options\n\n # Load config\n if @options['config'] then # Can be hash with values, or path to yaml\n config = SupportPal::Configure.new(@options['config'])\n else\n config = SupportPal::Configure.new\n end\n @config = config.config\n \n # Check to ensure required options exist\n raise Error, 'You must provide a base_uri option!' if ! @options['base_uri']\n self.class.base_uri @options['base_uri']\n\n raise Error, 'You must provide an auth token in config!' if ! @config[:auth_token]\n\n # Default headers\n @auth = { username: @config[:auth_token], password: 'X' }\n @http_options = { basic_auth: @auth }\n end",
"def initialize(options = {})\n @directory = options.delete(:dir) || Dir.pwd\n @chain = options.delete(:chain) || []\n @default = options.delete(:default)\n raise Error.new(\"Bad options #{options.inspect}\") if options.any?\n end",
"def initialize(options = {}, &connection_block)\n @configuration = DelSolr::Client::Configuration.new(options[:server], options[:port], options[:timeout], options[:path])\n @cache = options[:cache]\n @logger = options[:logger]\n @shortcuts = options[:shortcuts]\n setup_connection(&connection_block) if connection_block\n end",
"def initialize(options = {})\n opts = {\n oauth_site: 'https://user.gini.net/',\n oauth_redirect: 'http://localhost',\n api_uri: 'https://api.gini.net',\n api_version: 'v1',\n api_type: 'json',\n upload_timeout: 90,\n processing_timeout: 180,\n log: Logger.new(STDOUT),\n user_agent: \"gini-api-ruby/#{VERSION} (Faraday v#{Faraday::VERSION})\"\n }.merge(options)\n\n # Ensure mandatory keys are set\n [:client_id, :client_secret].each do |k|\n raise Gini::Api::Error.new(\"Mandatory option key is missing: #{k}\") unless opts.key?(k)\n end\n\n # Populate instance variables from merged opts\n opts.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n self.class.send(:attr_reader, k)\n end\n\n # Ensure STDOUT is flushed\n STDOUT.sync = true\n\n # Sanitize api_uri\n @api_uri.sub!(/(\\/)+$/, '')\n\n # Register parser (json+xml) based on API version\n register_parser\n\n @log.info('Gini API client initialized')\n @log.info(\"Target: #{@api_uri}\")\n end",
"def initialize(path, options = {})\n options = self.class.default_options.merge(options)\n if path.is_a?(GitAccess)\n options[:access] = path\n path = path.path\n end\n\n @path = path\n @repo_is_bare = options.fetch :repo_is_bare, nil\n @page_file_dir = options.fetch :page_file_dir, nil\n @page_file_dir = Pathname.new(\"/#{@page_file_dir}\").cleanpath.to_s[1..-1] if @page_file_dir\n @access = options.fetch :access, GitAccess.new(path, @page_file_dir, @repo_is_bare)\n @base_path = options.fetch :base_path, \"/\"\n @repo = @access.repo\n @ref = options.fetch :ref, self.class.default_ref\n @universal_toc = options.fetch :universal_toc, false\n @mathjax = options.fetch :mathjax, false\n @global_tag_lookup = options.fetch :global_tag_lookup, false\n @hyphened_tag_lookup = options.fetch :hyphened_tag_lookup, false\n @case_insensitive_tag_lookup = options.fetch :case_insensitive_tag_lookup, false\n @css = options.fetch :css, false\n @emoji = options.fetch :emoji, false\n @critic_markup = options.fetch :critic_markup, false\n @h1_title = options.fetch :h1_title, false\n @display_metadata = options.fetch :display_metadata, true\n @index_page = options.fetch :index_page, 'Home'\n @bar_side = options.fetch :sidebar, :right\n @user_icons = ['gravatar', 'identicon'].include?(options[:user_icons]) ?\n options[:user_icons] : 'none'\n @allow_editing = options.fetch :allow_editing, true\n @allow_uploads = options.fetch :allow_uploads, false\n @per_page_uploads = options.fetch :per_page_uploads, false\n @metadata = options.fetch :metadata, {}\n @filter_chain = options.fetch :filter_chain,\n [:YAML, :BibTeX, :PlainText, :CriticMarkup, :TOC, :RemoteCode, :Code, :Macro, :Emoji, :Sanitize, :PlantUML, :Tags, :PandocBib, :Render]\n @filter_chain.delete(:Emoji) unless options.fetch :emoji, false\n @filter_chain.delete(:PandocBib) unless ::Gollum::MarkupRegisterUtils.using_pandoc?\n @filter_chain.delete(:CriticMarkup) unless options.fetch :critic_markup, false\n\n Hook.execute(:post_wiki_initialize, self)\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @description = options[\"description\"]\n @git_repo = options[\"git_repo\"]\n end",
"def initialize(options)\n @api = GoogleReaderApi::Api::new options\n end",
"def initialize(options = {})\n @proxies = nil\n @socks_increase_timeouts = options[:socks_increase_timeouts] || SOCKS_INCREASE_TIMEOUTS\n @timeout = options[:timeout] || GENERAL_TIMEOUT\n @max_tries = options[:max_tries] || MAXIMUM_TRIES\n @force = options[:force] || FORCE_READ\n @min_page_length = options[:min_page_length] || MINIMUM_PAGE_LENGTH\n @reset_user_agent = options[:reset_ua] || RESET_USER_AGENT\n @min_proxy_response_time = options[:min_proxy_response_time] || MIN_PROXY_RESPONSE_TIME\n\n @agent = Mechanize.new\n @agent.history.max_size = 0\n\n @open_timeout = options[:open_timeout] || DEFAULT_OPEN_TIMEOUT\n @read_timeout = options[:read_timeout] || DEFAULT_READ_TIMEOUT\n\n if options[:proxies]\n @proxies = TheMask::ProxyList.new(options[:proxies])\n else\n @proxies = TheMask::ProxyList.new([options[:proxy]])\n end\n\n @agent.user_agent = TheMask.get_random_user_agent_str unless @reset_user_agent\n end",
"def initialize( args = {} )\n\n ::Octokit.configure do |c|\n c.access_token = args[:github_auth] || ENV['GITHUB_AUTH']\n c.auto_paginate = true\n end\n\n @params = {}\n @params[:context] = args[:context] or raise \"Requires a context\"\n @params[:target_url] = args[:url]\n \n path = args[:repo] || '.'\n @repo = GithubInformer.determine_repo(path)\n @sha = GithubInformer.determine_sha(path)\n end",
"def repos(options = {})\n Tinybucket::Resource::User::Repos.new(username, options)\n end",
"def initialize(options = {})\n @options = options.stringify_keys.reverse_merge('size' => DEFAULT_SIZE, 'path' => DEFAULT_PATH)\n initialize_file\n end",
"def initialize(options = {})\n @headers = options[:headers] || HEADERS\n @retries = options[:retries] || RETRIES\n @backoff_policy =\n options[:backoff_policy] || Sumologic::Metrics::BackoffPolicy.new\n\n uri = URI(options.fetch(:uri))\n http = Net::HTTP.new(uri.host, uri.port)\n http.set_debug_output(logger) if logger.level == Logger::DEBUG\n http.use_ssl = uri.scheme == 'https'\n http.read_timeout = 8\n http.open_timeout = 4\n\n @path = uri.path\n @http = http\n end",
"def initialize(repository_path, options = {})\n if File.exists? \"#{repository_path}/.git\"\n @git = Git.open(repository_path)\n else\n @git = Git.bare(repository_path)\n end\n @title = options[:title] || \"Gitfeed for #{repository_path.sub(/.*\\//, '')}\"\n @url = options[:url] || 'http://github.com/scotchi/gitfeed'\n @description = options[:description] || repository_path\n @template = options[:template] || File.expand_path('../entry.haml', __FILE__)\n @include_diffs = options[:include_diffs].nil? ? true : options[:include_diffs]\n @haml = Haml::Engine.new(File.read(@template))\n end",
"def initialize(repository = UserRepository.new)\n @repository = repository\n end",
"def initialize(options={})\n raise TypeError, 'options must be a Hash or respond to #to_h or #to_hash' unless options.is_a?(Hash) || options.respond_to?(:to_h) || options.respond_to?(:to_hash)\n options = options.to_h rescue options.to_hash\n \n @options = {\n matched_routes: [],\n ignored_routes: [],\n robots_json: SnapSearch.root.join('resources', 'robots.json'),\n extensions_json: SnapSearch.root.join('resources', 'extensions.json'),\n check_file_extensions: false\n }.merge(options) # Reverse merge: The hash `merge` is called on is used as the default and the options argument is merged into it\n \n @matched_routes, @ignored_routes, @check_file_extensions = options.values_at(:matched_routes, :ignored_routes, :check_file_extensions)\n \n self.robots_json = @options[:robots_json] # Use the setter method which sets the @robots_json instance variable to the path, then sets @robots to the parsed JSON of the path's contents.\n self.extensions_json = @options[:extensions_json] # Use the setter method which sets the @extensions_json instance variable to the path, then sets @extensions to the parsed JSON of the path's contents.\n end",
"def repo\n if @repo == NRSER::NO_ARG\n @repo = QB::Repo.from_path root_path\n end\n \n @repo\n end",
"def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend",
"def initialize(opts = {}, filter_opts = {})\n @filters = Archivist::Client::Filters.new(filter_opts)\n @opts = {\n page: 1,\n rows: 50\n }.merge(opts)\n\n @conn = DEFAULT_CONNECTION\n end",
"def initialize(options)\n if options[:auth]\n @auth = options[:auth]\n @auth_type = options[:auth_type] || :client_login\n else\n request_auth(options[:email],options[:password])\n end\n @cache = GoogleReaderApi::Cache.new(2)\n end",
"def initialize initial_options = {}\n @paging = false\n @classes = nil\n\n options = self.class.default_options.update(initial_options)\n\n @formatter_klass = options[:formatter]\n\n require 'profile' if options[:profile]\n\n @names = options[:names]\n @list = options[:list]\n\n @doc_dirs = []\n @stores = []\n\n RDoc::RI::Paths.each(options[:use_system], options[:use_site],\n options[:use_home], options[:use_gems],\n *options[:extra_doc_dirs]) do |path, type|\n @doc_dirs << path\n\n store = RDoc::RI::Store.new path, type\n store.load_cache\n @stores << store\n end\n\n @list_doc_dirs = options[:list_doc_dirs]\n\n @interactive = options[:interactive]\n @server = options[:server]\n @use_stdout = options[:use_stdout]\n @show_all = options[:show_all]\n @width = options[:width]\n\n # pager process for jruby\n @jruby_pager_process = nil\n end",
"def initialize(options={})\n @query, @max_results, @offset = nil\n @alt = 'atom'\n @strict = 'false'\n @v = 2\n\n @url = base_url\n set_instance_variables(options)\n\n @url << build_query_params(to_youtube_params)\n end",
"def initialize(options = {})\n @options = options\n @uri = options[:url] || URI\n end",
"def initialize(options = {})\n @file_path = options[:path]\n @max_players = options[:max_players] || 0\n\n raise CSstats::FileNotExist unless File.exist?(file_path.to_s)\n end",
"def initialize(commandlineopts)\n \n #Requiring things we need. Most of these are in stdlib, but nokogiri ain't\n begin\n require 'rubygems'\n require 'logger' \n require 'json'\n require 'date'\n #require 'resolv'\n\n rescue LoadError => e\n puts \"Couldn't load one of the required gems\"\n puts \"The error message may be useful\"\n puts e.to_s\n exit\n end\n \n @options = commandlineopts\n \n @base_dir = @options.report_directory\n @scan_dir = @options.scan_directory\n if !File.exists?(@base_dir)\n Dir.mkdirs(@base_dir)\n end\n\n if @options.logger\n @log = Logger.new(@base_dir + '/' + @options.logger)\n else\n @log = Logger.new(STDOUT)\n end\n #Change the line below to Logger::DEBUG to get debugging messages during the program run\n @log.level = Logger::WARN\n @log.debug(\"Log created at \" + Time.now.to_s)\n @log.debug(\"Scan type is : #{@options.scan_type}\")\n @log.debug(\"Directory being scanned is : #{@options.scan_directory}\") if @options.scan_type == :directory\n @log.debug(\"File being scanned is : #{@options.scan_file}\") if @options.scan_type == :file\n \n end",
"def open(options)\n OptionsHash!(options)\n @tc_path = options.require(\"path\")\n @tc_storage_path = options[\"storage_path\"] || (@tc_path + \".versions\")\n @tc_heads_path = options[\"heads_path\"] || (@tc_path + \".heads\")\n @tc_log_path = options[\"log_path\"] || (@tc_path + \".log\")\n @tc_storage = HDB::new\n @tc_heads = HDB::new\n @tc_log = BDB::new\n @tc_storage.open(:path => @tc_storage_path, :writer => true, :create => true)\n @tc_heads.open(:path => @tc_heads_path, :writer => true, :create => true)\n # FIXME: i don't really think we need this log file right now.\n @tc_log.open(:path => @tc_log_path, :writer => true, :create => true)\n # REFACTOR THIS\n # TODO: save repo uuid into the versions storage at the very top and ignore in the iterator.\n # brand new repository -> generate UUID for it\n if @tc_log.size == 0\n @uuid = generate_uuid(nil)\n @tc_log.put(REPO_UUID_TOKEN, @uuid)\n else\n @uuid = @tc_log.get(REPO_UUID_TOKEN)\n end\n nil\n end",
"def initialize( repo=nil, **args )\n\t\t@repo = Pathname( repo ) if repo\n\n\t\t@reader = nil\n\t\t@writer = nil\n\n\t\t@pid = nil\n\n\t\t@byte_input_callback = nil\n\t\t@line_input_callback = nil\n\tend",
"def initialize(options)\n case options\n when Hash\n # Nothing to do\n when Array\n options = options.first\n when SearchRequest\n raise \"Can't create SearchRequest from SearchRequest. Use SearchRequest.create\"\n else\n raise \"Can't create SearchRequest from #{options.class}\"\n end\n \n options.assert_valid_keys ATTRIBUTES\n\n @city = options[:city]\n city.strip! if city\n\n @publisher = options[:publisher]\n raise \"publisher required\" unless publisher\n\n @categories = Array.wrap(options[:categories])\n\n @radius = options[:radius]\n self.radius = radius.to_i\n\n @state = options[:state]\n state.strip! if state\n\n @text = options[:text]\n text.strip! if text\n\n @postal_code = options[:postal_code]\n postal_code.strip! if postal_code\n\n @sort = options[:sort]\n sort.strip! if sort\n \n @featured = options[:featured].present? ? options[:featured].to_s == 'true' : false\n \n if postal_code.blank? && text.zip_code?\n self.postal_code = text\n self.text = nil\n else\n if radius == 0 && publisher.default_offer_search_distance\n self.radius = publisher.default_offer_search_distance\n end\n end\n \n # set the default postal code, if we are doing a default search\n # ie, no search text\n if @text.blank?\n @postal_code ||= publisher.default_offer_search_postal_code unless publisher.default_offer_search_postal_code.blank?\n end\n \n self.postal_code = postal_code_from(self.postal_code, city, state)\n end",
"def initialize(base, options={});\n @options = options.reverse_merge(\n :extension => '.xml.gz',\n :start => 1\n )\n @base = base\n reset\n end",
"def initialize(options={})\n self.host = options[:host] || \"127.0.0.1\"\n self.port = options[:port] || 8087\n self.client_id = options[:client_id] unless options[:client_id].blank?\n \n read_quorum = options[:r] || options[:read_quorum]\n write_quorum = options[:w] || options[:write_quorum]\n replica_commit = options[:dw] || options[:replica_commit]\n return_body = options[:rb] || options[:return_body] || true\n \n @options = options.slice!(:host, :port, :client_id, :r, :read_quorum, :w, :write_quorum, :dw, :replica_commit, :rb, :return_body)\n @options[:r] = read_quorum unless read_quorum.blank?\n @options[:w] = write_quorum unless write_quorum.blank?\n @options[:dw] = replica_commit unless replica_commit.blank?\n @options[:return_body] = return_body unless return_body.blank?\n \n @buckets = []\n @bucket_cache = Hash.new{|k,v| k[v] = Riakpb::Bucket.new(self, v, @options)}\n end",
"def get_repository request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_repository_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ArtifactRegistry::V1beta2::Repository.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get(key, options = {})\n if key.is_a? Array\n key = key[0]\n end\n if !key.nil? && key != '' && key != '.'\n key = key.chomp('/')\n if key.include? '/'\n dir = key + '/'\n ret = service.head_object(dir, options)\n new(key: key) if ret.data[:status] == 200\n else\n remap_attributes(options, {\n :delimiter => 'delimiter',\n :marker => 'marker',\n :max_keys => 'max-keys',\n :prefix => 'prefix'\n })\n data = service.get_bucket(key, options)\n directory = new(:key => data['Name'], :is_persisted => true)\n options = {}\n for k, v in data\n if ['CommonPrefixes', 'Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(k)\n # Sometimes, the v will be a Array, like \"Name\"=>[\"blobstore-droplet1\"], \"Prefix\"=>[{}], \"Marker\"=>[{}], \"MaxKeys\"=>[\"100\"], \"Delimiter\"=>[{}], \"IsTruncated\"=>[\"false\"]\n # and there needs to parse them\n if !v.nil? && (v.is_a? Array) && (v.size > 0)\n if v[0].is_a? Hash\n v = nil\n else\n v = v[0]\n end\n end\n options[k] = v\n end\n end\n directory.files.merge_attributes(options)\n if data.key?('Contents') && !data['Contents'].nil?\n directory.files.load(data['Contents'])\n end\n directory\n end\n else\n new(key: '')\n end\n rescue Fog::Storage::Aliyun::NotFound\n nil\n end",
"def initialize(options = {})\n self.http_connection_factory = options.delete(:http_connection_factory) || Net::HTTP\n end",
"def initialize project = \"\", opt = {} \n self.project = project.should_not! :be_nil \n self.options = opt.to_openobject \n \n # DB\n self.db_name = project\n self.connection = Mongo::Connection.new # nil, nil, :logger => Logger.new(STDOUT)\n self.connection.drop_database db_name if options.clear? \n self.db = connection.db db_name\n \n # File Storage\n options.base_directory.should_not_be! :blank\n self.base_directory = \"#{options.base_directory}/#{project}\"\n FileUtils.rm_rf base_directory if options.clear?\n FileUtils.mkdir_p base_directory unless File.exist? base_directory\n end",
"def get_repositories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RepositoryApi.get_repositories ...'\n end\n # resource path\n local_var_path = '/v1/repository'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Repository>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RepositoryApi#get_repositories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(options = {})\n @rate_limit = options[:rate_limit] || Redd::RateLimit.new\n @user_agent = options[:user_agent] || \"Redd/Ruby, v#{Redd::VERSION}\"\n @api_endpoint = options[:api_endpoint] || \"https://www.reddit.com/\"\n end",
"def initialize(options = {})\n self.class.options ||= Ramaze::Cache::Sequel.trait[:default].merge(options)\n @options = options.merge(self.class.options)\n end",
"def initialize(*args, &block)\n if args.first.is_a?(Symbol)\n @name = args.shift\n end\n\n if args.last.is_a?(Hash)\n options = args.pop\n @per_page = options[:per_page]\n @protocol = options[:protocol]\n @host = options[:host]\n @folder = options[:folder]\n @collection = options[:collection]\n end\n\n @block = block\n end",
"def initialize(target_dir, repository)\n self.target_dir = target_dir\n raise \"GitHub backup directory, #{self.target_dir}, does not exist!\" unless File.directory?(self.target_dir)\n\n self.repository = repository\n end",
"def initialize(options = {})\n super\n @uri = options[:uri] || \"druby://127.0.0.1:7632\"\n @timeout = options[:timeout] || 0\n @prior_values = {}\n end",
"def initialize(options = {})\n @options = options\n @cache = {}\n load\n end",
"def retrieve(options, &block)\n expiry_time_value = options.fetch('expires', nil)\n if expiry_time_value\n expiry_time = Time.parse(expiry_time_value)\n raise ArgumentError, \"Download expired at #{expiry_time}\" if expiry_time < Time.now\n end\n\n download_options = extract_download_options(options)\n url = download_options[:url]\n\n case url.scheme\n when 'file'\n retrieve_file(download_options, &block)\n when /https?/\n retrieve_http(download_options, &block)\n else\n raise URI::BadURIError, \"Unknown URI scheme: #{url.scheme}\"\n end\n end",
"def initialize(options={})\n @api_key = options[:api_key] || config.api_key\n @path = options[:path]\n @params = options[:params]\n @http_request_options = options[:http_request_options] || {}\n end",
"def initialize\n @settings = Settings.instance\n @options = {\n base_uri: @settings.get('api_endpoint'),\n timeout: @settings.get('timeout').to_i / 1000\n }\n end",
"def initialize(options = default_options)\n options.each { |key, value| instance_variable_set(\"@#{key}\", value) }\n yield(self) if block_given?\n\n @auth_client = Fabricio::Authorization::AuthorizationClient.new\n raise StandardError.new(\"Session is empty: #{auth_data}\") if obtain_session.nil?\n\n network_client = Fabricio::Networking::NetworkClient.new(@auth_client, @session_storage)\n\n @organization_service ||= Fabricio::Service::OrganizationService.new(param_storage, network_client)\n @app_service ||= Fabricio::Service::AppService.new(param_storage, network_client)\n @build_service ||= Fabricio::Service::BuildService.new(param_storage, network_client)\n @version_service ||= Fabricio::Service::VersionService.new(param_storage, network_client)\n\n param_storage.store(options[:params]) unless options[:params].empty?\n fill_default_params\n end",
"def initialize(**options)\n if options.fetch(:refresh, true)\n refresh_list!(options.fetch(:filters, {}))\n else\n @proxies = []\n end\n\n files = Array(options.fetch(:file, options.fetch(:files, [])))\n load_proxies_from_files!(files) if files&.any?\n\n cleanup! if options.fetch(:validate, false)\n end",
"def initialize(opts={})\n @base_dir = File.expand_path(opts[:base_dir] || Dir.pwd)\n @reports_dir = File.expand_path(File.join(@base_dir, \"reports\"))\n @cache_dir = File.expand_path(File.join(@base_dir, \"cache\"))\n @gems_dir = File.expand_path(File.join(@cache_dir, \"gems\"))\n\n @base_path = Pathname.new(@base_dir)\n @reports_path = Pathname.new(@reports_dir)\n @cache_path = Pathname.new(@cache_dir)\n @gems_path = Pathname.new(@gems_dir)\n\n @tag = opts[:tag] || \"current\"\n @freshen = opts[:freshen] != false\n @dryrun = opts[:dryrun] == true || false\n end",
"def initialize(base=nil)\r\n get(base)\r\n end",
"def initialize(options)\n initialize_options(options)\n initialize_headers\n http_request\n end",
"def initialize(options={})\n @options = options\n\n self.safe = options[:safe]\n #self.file = options[:file]\n self.keep = options[:keep]\n self.scope = options[:scope] || BasicObject.new\n self.multi_key = options[:multikey]\n end",
"def new(options)\n if options.has_key? :directory\n dir = self[options.delete(:directory)]\n FileUtils.mkdir_p dir.path\n else\n file = self[options.delete(:file)]\n if (binary_content = options.delete(:with_binary_content) || options.delete(:with_binary_contents))\n file.binary_content = binary_content\n else\n file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')\n end\n end\n\n raise \"unexpected keys '#{options.keys.join(', ')}'\" unless options.empty?\n\n dir || file\n end",
"def initialize(options = {})\n self.class.options ||= Ramaze::Cache::Sequel.trait[:default].merge(\n options\n )\n\n @options = options.merge(self.class.options)\n end",
"def initialize(base_uri, options={})\n @base_uri = base_uri\n @uri_parts = []\n @headers = options[:headers] || {}\n @params = options[:params] || {}\n @extension = options[:extension]\n end",
"def initialize(options = {})\n [:package, :header, :relative_filename, :filename, :content, :pool].each do |field|\n send(\"#{field}=\", options[field]) if options[field]\n end\n \n end",
"def initialize(*args)\n @options = {\n :access_level => 'public-read',\n :file_mapping => nil,\n :object => nil\n }\n @options.update(args.extract_options!)\n @options.stringify_keys!\n\n @raw_file = args.first\n @config = configuration\n @connection = Uv::Storage::Connection.new(self.config)\n @object = @options['object']\n\n debug \"Initializing new Uv::Storage::File\"\n debug \"Args First is a: #{args.first.class.to_s}\"\n debug \"Config loaded: #{config.present?}\"\n debug \"Connection loaded: #{connection.present?}\"\n debug \"Object given: #{object.present?}\"\n debug \"Raw File given: #{@raw_file.present?}\"\n debug \"Options given: #{options.present?}\"\n debug \"Identifier given: #{options['identifier'].present?}\"\n\n validate_object(@object) if @object.present?\n end",
"def initialize(options={})\n @endpoint = options[:endpoint]\n @account_id = options[:account_id]\n @service_key = options[:service_key]\n @configuration = options[:configuration] || \"_000000_0_00000001_1101010110001100_1_0000000000000111111102000000000010000100000000000000000000100\"\n @revision_date = options[:revision_date]\n end",
"def repo\n @repo ||= OctocatHerder::Repository.new(@raw['repo'], connection)\n end"
] | [
"0.60007846",
"0.59225047",
"0.5810175",
"0.57941556",
"0.57857066",
"0.56690556",
"0.56603605",
"0.55891526",
"0.5570333",
"0.5541875",
"0.5427734",
"0.54188174",
"0.54188174",
"0.54170644",
"0.53255606",
"0.5310664",
"0.5272521",
"0.5267841",
"0.5257171",
"0.52560174",
"0.5253125",
"0.52465785",
"0.52388114",
"0.5218007",
"0.52035916",
"0.51774466",
"0.51763356",
"0.5160874",
"0.51361364",
"0.5113168",
"0.5091564",
"0.5090528",
"0.5086226",
"0.5086226",
"0.507827",
"0.50652945",
"0.50652874",
"0.5064881",
"0.5045131",
"0.50437754",
"0.50407845",
"0.5024218",
"0.5019151",
"0.50178456",
"0.5010288",
"0.49952075",
"0.49874616",
"0.49851727",
"0.4978977",
"0.49718297",
"0.49708822",
"0.49686646",
"0.49608177",
"0.49593642",
"0.4959022",
"0.49491277",
"0.49457824",
"0.49439904",
"0.4940511",
"0.494029",
"0.49401566",
"0.49370587",
"0.49346974",
"0.49325955",
"0.4932374",
"0.493229",
"0.4931443",
"0.49290565",
"0.49234563",
"0.49202836",
"0.49160376",
"0.49127442",
"0.4910109",
"0.4903508",
"0.49023908",
"0.48999217",
"0.4895158",
"0.48941883",
"0.48885387",
"0.48840877",
"0.48799324",
"0.48738092",
"0.4866883",
"0.4866375",
"0.48590228",
"0.48511103",
"0.48486194",
"0.48444277",
"0.48444068",
"0.4843695",
"0.48433083",
"0.4840591",
"0.4839338",
"0.48383218",
"0.48380277",
"0.48332605",
"0.482508",
"0.4819541",
"0.4815313",
"0.48062658"
] | 0.7508474 | 0 |
Determines if retriever is available (has required CLI tools, etc.) | def available?
raise ::NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available?\n unless @@available\n begin\n # FIX: we might want to parse the result and require a minimum curl\n # version.\n cmd = \"curl --version\"\n `#{cmd}`\n if $?.success?\n @@available = true\n else\n raise RetrieverError, \"\\\"#{cmd}\\\" exited with #{$?.exitstatus}\"\n end\n rescue\n @logger.note_error($!, :available, \"download retriever is unavailable\")\n end\n end\n @@available\n end",
"def available?\n unless @@available\n begin\n # FIX: we might want to parse the result and require a minimum svn\n # client version.\n cmd = \"svn --version\"\n `#{cmd}`\n if $?.success?\n @@available = true\n else\n raise RetrieverError, \"\\\"#{cmd}\\\" exited with #{$?.exitstatus}\"\n end\n rescue\n @logger.note_error($!, :available, \"svn retriever is unavailable\")\n end\n end\n @@available\n end",
"def available?\n unless @@available\n begin\n require 'git'\n # note that require 'git' does the same version check on load but\n # we don't want to assume any particular implementation.\n #\n # FIX: we might want to parse the result and require a minimum git\n # client version.\n cmd = \"git --version\"\n `#{cmd}`\n if $?.success?\n @@available = true\n else\n raise RetrieverError, \"\\\"#{cmd}\\\" exited with #{$?.exitstatus}\"\n end\n rescue\n @logger.note_error($!, :available, \"git retriever is unavailable\")\n end\n end\n @@available\n end",
"def available?\n begin\n execute('show info')\n true\n rescue Exception => e\n false\n end\n end",
"def available?\n !!version\n end",
"def executable_installed?\n @cli.system_call 'which gcloud'\n $?.success?\n end",
"def available?\n !version.nil?\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",
"def proselint_installed?\n `which proselint`.strip.empty? == false\n end",
"def server_is_available?\n return true\n !@http_client.send_request(:get, \"#{@configuration.protocol}://#{@configuration.host}:#{@configuration.port}\", nil, {:timeout => 5}).nil?\n end",
"def kacl_cli_installed?\n `which kacl-cli`.strip.empty? == false\n end",
"def available?\n true\n end",
"def installed?\n false\n end",
"def chef_client?\n chef_client.present?\n end",
"def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end",
"def installed?\n ::File.exist?(PATH)\n end",
"def available?\n @backends.present?\n end",
"def fuseki_available?(**args)\n prefix = get_fuseki_command_prefix args\n command = \"#{prefix}fuseki-server --version > /dev/null 2>&1\"\n !!(system command)\n end",
"def available?\n resp = get do |req|\n req.url '/'\n end\n resp.status == 200\n end",
"def installed?\n File.exists?(@path)\n end",
"def installed?(tool)\n # first: check with updatedb\n if session.locate_updatedb? == true\n out = ''\n if (session.methods.include? :cache) && session.cache.exists?(\"ls_path\")\n out = session.cache.read(\"ls_path\")\n else\n out = ''\n env_paths = get_all_path\n for path in env_paths\n out << session.updatedb_search(path).join(\"\\n\").to_s\n end\n end\n session.cache.add(\"ls_path\", out) if session.methods.include? :cache\n\n out.each_line do |line|\n line.chomp!\n return line if line =~ /\\/#{tool}$/\n end\n end\n\n # second: if cache run ls for every path once and cache it\n if session.methods.include? :cache\n out = ''\n if session.cache.exists?(\"ls_path\")\n out = session.cache.read(\"ls_path\")\n else\n env_paths = get_all_path\n # ls:\n # -m fill width with a comma separated list of entries\n cmd = \"/bin/ls -m\"\n for path in env_paths\n # adding timeout because it may need some time if many\n # tools are installed\n # out << cmd_exec(\"#{cmd} #{path}/*\", 20, 60 * 2)\n tmp = session.shell_command_token(\"#{cmd} #{path}/*\", 20, 60 * 2)\n tmp.split(',').each do |tmp_tool|\n tmp_tool.chomp!\n tmp_tool.strip!\n out << tmp_tool + \"\\n\"\n end\n end\n # out.gsub!(\"\\t\", \"\\n\")\n session.cache.add(\"ls_path\", out)\n end\n out.each_line do |line|\n line.chomp!\n return line if line =~ /\\/#{tool}$/\n end\n\n return false\n end\n\n # third: fallback: using traditional which\n out = cmd_exec(\"which #{tool}\")\n if out[0, 1] == '/'\n return out\n else\n return nil\n end\n end",
"def aptitude?\n File.executable? '/usr/bin/apt-get'\n end",
"def has_installer?\n !installer_path.nil?\n end",
"def gem_is_available?\n @thor.say(\"Check if #{@name} is available as a gem name.\", :yellow)\n uri = URI.parse(\"https://rubygems.org/api/v1/gems/#{@name}.json\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n\n return response.code == '404'\n rescue SocketError => e\n # rubygems is down, skip check\n return true\n end",
"def gem_is_available?\n @thor.say(\"Check if #{@name} is available as a gem name.\", :yellow)\n uri = URI.parse(\"https://rubygems.org/api/v1/gems/#{@name}.json\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n\n return response.code == '404'\n rescue SocketError => e\n # rubygems is down, skip check\n return true\n end",
"def check_install?\n @default_options[ :check_install ]\n end",
"def launchctl?\n launchctl.present?\n end",
"def launchctl?\n launchctl.present?\n end",
"def installed?\n revision && install_path.exist?\n end",
"def available?\n true\n end",
"def available?\n return false\n end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nend",
"def check_for_executable; end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n puts \"[*] - esearchy requires #{name}.\"\n if RUBY_PLATFORM =~ /mingw|mswin/\n \tsystem \"gem install #{name}\"\n else\n \tsystem \"sudo gem install #{name}\"\n end\nend",
"def exist?\n ruby_gems_fetcher.started?\n end",
"def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end",
"def ri_installed?\n File.exist? @ri_dir\n end",
"def ri_installed?\n File.exist? @ri_dir\n end",
"def chef_installed?\n cmd_if %{rvm use #{ruby} >/dev/null && gem list --no-versions | grep -q \"^chef$\" >/dev/null}, true\nend",
"def installed?\n !installed_version.nil?\n end",
"def available?\n AvailableResponse.new(request(:get, '/information')).success?\n end",
"def find_command_enabled?\n $find_command_enabled ||= scanned_client_server!.features.find_command_enabled?\nend",
"def find_command_enabled?\n $find_command_enabled ||= scanned_client_server!.features.find_command_enabled?\nend",
"def available?\n options[:force] || true\n end",
"def non_script_option?\n version || help || remote\n end",
"def python?\n exist? 'requirements.txt'\n end",
"def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end",
"def client_is_zypp?\n File.stat(\"/usr/bin/zypper\").executable?\nend",
"def chef_client?(env)\n provisioners(:chef_client, env).any?\n end",
"def pkg_installed?(pkg)\n cmd_if %{dpkg-query --showformat='${Essential}\\n' --show '#{pkg}' > /dev/null 2>&1}\nend",
"def available?\n @available ||= begin\n response = RestClient::Request.execute(\n method: :get,\n url: build_jobs_url,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n response.code == 200 ? true : false\n rescue Timeout::Error => e\n false\n rescue => e\n false\n end\n end",
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nrescue\n Gem.available?(name) #for backwards compatibility\nend",
"def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end",
"def remote_exists?\n system \"which cmus-remote &> /dev/null\"\nend",
"def check_pkg_info\n return false if options['package_url'].nil? ||\n options['package_name'].nil?\n true\nend",
"def system_load_ok?\n true\n end",
"def gem_only_available?()\n return !determine_common_folder() && is_dtk_common_core_gem_installed?\nend",
"def dot_installed?\n assert_usr_bin_env_exists\n system \"#{USR_BIN_ENV} which dot > /dev/null\"\n end",
"def installed?\n File.exist?(ktlint_path)\n end",
"def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end",
"def check_pythons_for_virtenv\n @candidate_pythons.each{ |py|\n if has_virtualenv_installed(py)\n @command = py\n return true\n end\n }\n return false\n end",
"def installed?\n raise NotImplementedError\n end",
"def installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end",
"def lkrg_installed?\n cmd_exec('test -d /proc/sys/lkrg && echo true').to_s.strip.include? 'true'\n rescue\n raise 'Could not determine LKRG status'\n end",
"def has_os?\n delegate(provider, :has_os?)\n end",
"def require_manager_name?\n !!(self.registered_download.require_manager_name?)\n end",
"def retrieve\n if pypkg = provider.query\n pypkg[:ensure]\n else\n :absent\n end\n end",
"def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend",
"def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end",
"def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end",
"def available?\n false\n end",
"def grsec_installed?\n cmd_exec('test -c /dev/grsec && echo true').to_s.strip.include? 'true'\n rescue\n raise 'Could not determine grsecurity status'\n end",
"def check_for_installed_software_only\n check_all_installed @options\n end",
"def installed?\n !!@installed\n end",
"def xcov_available?\n `which xcov`.split(\"/\").count > 1\n end",
"def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n # Otherwise we check that the system supplied python will be sufficient\n check_system_python\n end\n end",
"def resource_exists?\n path_exists? install_dir\nend",
"def command_available?(command)\n find = Releasy.win_platform? ? \"where\" : \"which\"\n # Call this Kernel version of `` so it can be mocked in testing.\n result = Kernel.`(\"#{find} #{command}\")\n return false unless $? == 0\n result\n end",
"def CheckAvailable(gedit)\n\tif gedit.versionNumber()<1.29\n\t\tputs \"This script requires GEDitCOM II, Version 1.3 or newer.\"\n\t\treturn 0\n\telsif gedit.documents().count()<1\n\t\tprint \"You have to open a document in GEDitCOM II to use this script\"\n\t\treturn 0\n\tend\n\treturn 1\nend",
"def supports?\n [email protected]?\n end",
"def installed?\n path.exist? || path.symlink?\n end",
"def has_ssh?\n discover_ssh_executable.present?\n end",
"def cookbooks_repo_installed?\n cmd_test %{-d \"#{cookbooks_path}\"}\nend",
"def tool_exist?\n get_tools.each do |tool|\n return true if tool[\"name\"] == @tool_name\n end\n return false\n end",
"def dell_server?\n provider.dell_server?\n end",
"def available?()\n #This is a stub, used for indexing\n end",
"def resolver_exists?\n !options['resolver'].nil? &&\n File.exist?(options['resolver'])\nend",
"def supports_suggest_output?\n $client.version_support.es_version_2_x?\nend",
"def installed?\n source_api.number_of_units.positive? && positive_availability?\n end",
"def setup?\n Crocoduck::Store.server_cluster && \n Crocoduck::Store.server_db && \n Crocoduck::Store.server_collection\n end",
"def tooling?\n true\n end",
"def ri_installed?\n File.exist?(File.join(@doc_dir, \"ri\"))\n end",
"def installed?(utility)\n return false if execute_as_root(\"which #{utility}\").nil?\n true\n end",
"def config_tool_needed?\n false\n end",
"def can_rest?\n return false if driver_options[:ssh_options] && driver_options[:ssh_user]\n\n _, host, port = driver_url.split \":\", 3\n host != \"localhost\" || port.to_i > 0\n end",
"def installed?\n self.class.installed?(@repo)\n end",
"def which command\n require 'open3'\n Open3.popen3(\"which #{command}\") do |stdin, stdout, stderr, wait_thr|\n if wait_thr.value.to_i == 0\n availability = true\n else\n availability = false\n end\n return availability\n end\n end",
"def version_requested?\n @version_requested\n end",
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def ready?\n QA::Runtime::Logger.debug 'Checking Smocker readiness'\n get(\"#{admin_url}/version\")\n true\n # rescuing StandardError because RestClient::ExceptionWithResponse isn't propagating\n rescue StandardError => e\n QA::Runtime::Logger.debug \"Smocker not ready yet \\n #{e}\"\n false\n end"
] | [
"0.74351376",
"0.7418762",
"0.73860985",
"0.69866234",
"0.6773988",
"0.672853",
"0.6643747",
"0.6522838",
"0.63707566",
"0.6365694",
"0.6263562",
"0.6247108",
"0.624292",
"0.62037903",
"0.61974204",
"0.61874723",
"0.61702406",
"0.61671",
"0.616553",
"0.6155299",
"0.61328405",
"0.6128951",
"0.6099227",
"0.6084347",
"0.6084347",
"0.6084258",
"0.6076619",
"0.6076619",
"0.60601944",
"0.60466415",
"0.60419303",
"0.6039672",
"0.6030913",
"0.6022182",
"0.60185266",
"0.6004073",
"0.5996052",
"0.5996052",
"0.59835064",
"0.59823936",
"0.5980217",
"0.59674466",
"0.59674466",
"0.5966858",
"0.5965564",
"0.5958957",
"0.5954241",
"0.5948118",
"0.5939053",
"0.59026945",
"0.59021026",
"0.5896745",
"0.5891809",
"0.5889414",
"0.58628875",
"0.5862156",
"0.5857567",
"0.5852048",
"0.58438575",
"0.5829792",
"0.58283705",
"0.5827439",
"0.58208424",
"0.5820429",
"0.58135563",
"0.58077097",
"0.579338",
"0.5791962",
"0.578155",
"0.578155",
"0.5781316",
"0.5779148",
"0.576789",
"0.573491",
"0.57328105",
"0.5728385",
"0.5724864",
"0.57238996",
"0.57143795",
"0.5710643",
"0.5709847",
"0.5702173",
"0.5695044",
"0.5681212",
"0.5679348",
"0.56767267",
"0.5672745",
"0.5658865",
"0.56471705",
"0.5645041",
"0.56446904",
"0.56421334",
"0.56370497",
"0.5625236",
"0.5620684",
"0.5608804",
"0.56025034",
"0.5598519",
"0.5595626",
"0.55796134"
] | 0.56945366 | 83 |
Paths to ignore when traversing the filesystem. Mostly used for things like Git and Subversion version control directories. === Return list(Array):: list of filenames to ignore. | def ignorable_paths
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignored\n [\n '.agignore',\n '.cvsignore',\n '.gitignore',\n '.hgignore',\n ].map do |file_with_ignore_patterns|\n if File.exist? file_with_ignore_patterns\n patterns = File.read(file_with_ignore_patterns).split(\"\\n\")\n patterns.map do |pattern|\n next if pattern =~ /^#/\n next if pattern =~ /^\\s*$/\n \"-not \\\\( -path \\\"*#{pattern}*\\\" -prune \\\\)\"\n end.compact.join(' ')\n else\n ''\n end\n end.join(' ') + [\n \"-not \\\\( -path \\\"*\\\\.git*\\\" -prune \\\\)\"\n ].join(' ')\nend",
"def ignored_files\n all_files.select { |f| ignore_matcher.matched?(f) }\n end",
"def ignore_paths\n Dir.glob(\"**/*\").select { |f| File.directory? f }\n .collect { |name| \"#{name}/\" }\n - [\"app/\",\n \"app/views/\",\n \"app/views/branded/\",\n \"app/views/branded/public_pages/\",\n \"app/views/branded/home/\",\n \"app/views/branded/contact_us/\",\n \"app/views/branded/contact_us/contacts/\",\n \"app/views/branded/shared/\",\n \"app/views/branded/layouts/\",\n \"app/views/branded/static_pages/\"]\nend",
"def exclude_ignored_paths(dirs, ignore_paths = self.ignore_paths)\n Dir.glob(dirs.map { |d| \"#{d.sub(%r{/+$}, '')}/*\" }, File::FNM_DOTMATCH).reject do |path|\n ignore_paths.include?(File.basename(path))\n end\n end",
"def excluded_files() = []",
"def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end",
"def ignore_paths(options)\n source = options['source']\n destination = options['destination']\n config_files = Configuration[options].config_files(options)\n paths = config_files + Array(destination)\n ignored = []\n\n source_abs = Pathname.new(source).expand_path\n paths.each do |p|\n path_abs = Pathname.new(p).expand_path\n begin\n rel_path = path_abs.relative_path_from(source_abs).to_s\n ignored << Regexp.new(Regexp.escape(rel_path)) unless rel_path.start_with?('../')\n rescue ArgumentError\n # Could not find a relative path\n end\n end\n ignored\n end",
"def files\n @files ||= Dir.glob(File.join(@root, '**/*'), GLOB_FLAGS).select do |path|\n File.file?(path) && path !~ IGNORE_REGEX\n end\n end",
"def blacklisted_dir_entries\n %w[. ..]\n end",
"def exclude_paths\n @source_paths ||= []\n end",
"def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end",
"def ignore_includes\n ret = []\n ret << \"_includes/jekyll/**/*\"\n ret << [\"_includes/styleguide\", \"_includes/styleguide/**/*\"]\n ret << \"_includes/*.html\"\n ret << [\"_includes/atoms/figure\", \"_includes/atoms/figure/*\"]\n ret << [\"_includes/atoms/sanitize.html\", \"_includes/atoms/imagetitle.html\", \"_includes/atoms/classname.html\"]\n ret\n end",
"def ignores(*file_paths)\n self.ignore_paths += file_paths\n end",
"def ignore\n @ignore ||= []\n end",
"def ignored\n ignores.map {|ignore| ignore.ignoreable}\n end",
"def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end",
"def ignore_assets\n ret = []\n ret << [\"assets/styles/atoms/flex\", \"assets/styles/atoms/flex/*\"]\n ret << [\"assets/styles/styleguide\", \"assets/styles/styleguide/**/*\"]\n ret << \"assets/styles/**/*.liquid\"\n ret << \"assets/styles/**/*.css\"\n ret << \"assets/styles/*.scss\"\n ret\n end",
"def clean_paths\n cached_used = used_files\n glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD\n files = Pathname.glob(root + \"**/*\", glob_options).map(&:to_s)\n\n files.reject! do |candidate|\n candidate = candidate.downcase\n candidate.end_with?('.', '..') || cached_used.any? do |path|\n path = path.downcase\n path.include?(candidate) || candidate.include?(path)\n end\n end\n files\n end",
"def find_all_ignored\n skipped = []\n\n rubocop = YAML.load_file('./.rubocop.yml')\n rubocop['AllCops']['Exclude'].each do |ignored|\n skipped << ignored.split('/')[0]\n end\n\n skipped\nend",
"def ignored\n @ignored ||= []\n @ignored.map(&:to_s)\n end",
"def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end",
"def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end",
"def ignore_dirs(path)\n self.ignored_dirs= path\n end",
"def all_files_except_git\n Dir.glob('*', File::FNM_DOTMATCH).delete_if { |file| file =~ /\\A\\.{1,2}\\z|\\A\\.git\\z/ }\n end",
"def git_ignore(*paths)\n paths.each {|path| append_to_file '.gitignore', \"#{path}\\n\"}\n end",
"def svn_ignore_files( *pathnames )\n\tpathnames.flatten!\n\n\tmap = pathnames.inject({}) do |map,path|\n\t\tmap[ path.dirname ] ||= []\n\t\tmap[ path.dirname ] << path.basename\n\t\tmap\n\tend\n\n\ttrace \"Ignoring %d files in %d directories.\" % [ pathnames.length, map.length ]\n\n\tmap.each do |dir, files|\n\t\ttrace \" %s: %p\" % [ dir, files ]\n\t\tio = open( '|-' ) or exec 'svn', 'pg', 'svn:ignore', dir\n\t\tignorelist = io.read.strip\n\t\tignorelist << \"\\n\" << files.join(\"\\n\")\n\t\tsystem 'svn', 'ps', 'svn:ignore', ignorelist, dir\n\tend\nend",
"def ignore(*paths)\n paths.each do |path|\n if path.is_a? Array\n config.ignore.concat path\n else\n config.ignore << path\n end\n end \n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end",
"def excludes\n return Dir.chdir( base ) {\n %w(. .. .svn .git .hg CVS Rakefile) + files_for_erb +\n Dir.glob( '*~' ) + Dir.glob( '#*#' ) + Dir.glob( '*.bak' )\n }\n end",
"def find_files_without(source_path, ignored_paths, end_with = \"*.rb\")\n files_paths = Dir.glob(\"./#{source_path}/**/#{end_with}\")\n files_paths.select do |file_path|\n ignored_paths.map do |path|\n file_path.include?(\"/#{path}/\")\n end.none?\n end\n end",
"def exclude_dir\n @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?)\n end",
"def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end",
"def excluded\n return [] if directory.empty? || directory == '*'\n @excluded ||= process_exclusions(@raw_data['exclude'])\n end",
"def ignore_orphan_files_from(paths_to_ignore)\n @ignored_orphan_files_paths << {\n ignored_paths: paths_to_ignore.is_a?(Array) ? paths_to_ignore : [paths_to_ignore],\n nodes_selectors_stack: current_nodes_selectors_stack\n }\n end",
"def non_dir_files(path)\n `find -L #{path}`\n .split\n .map { |f| Pathname.new(f) }\n .reject { |f| f.directory? }\n .map { |f| f.relative_path_from(path) }\nend",
"def excluded_files\n # TODO: also append files marked as %{exclude} (or handle elsewhere?)\n missing_files_for(upstream_gem)\n end",
"def unneeded_files_in_destination\n requested_paths = files.map do |file|\n file.pkg_destination_path\n end\n\n existing_paths = FileFinders::Normal.new(destination_path).find_all('*')\n\n unnecessary_paths = existing_paths - requested_paths\n\n unnecessary_paths.select! do |path|\n !::File.directory?(File.join(destination_path, path))\n end\n\n unnecessary_paths\n end",
"def find_files(path)\r\n Dir.entries(path).reject {|f| f =~ /^\\./} || Array.new\r\nend",
"def gitignores\n %w[/tmp/librarian/]\n end",
"def getFiles(theArgs)\n\n\ttheFiles = [];\n\tpathsExclude = theArgs[:exclude];\n\n\ttheArgs[:paths].each do |pathRoot|\n\t\n\t\tif (File.exist?(pathRoot))\n\t\t\tFind.find(pathRoot) do |thePath|\n\t\t\t\tif (File.file?(thePath))\n\n\t\t\t\t\tif (!pathsExclude.include?(thePath))\n\t\t\t\t\t\tif (!FILES_EXCLUDE.include?(File.basename(thePath)))\n\t\t\t\t\t\t\ttheFiles << thePath;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tputs \"Skipping #{pathRoot}, file not found\";\n\t\tend\n\tend\n\n\treturn theFiles;\n\nend",
"def exclude_files(files, pwd)\n Dir.chdir(pwd)\n exclusions = @engine_config['exclude_paths'] || []\n files.reject { |f| exclusions.include?(f) }\n end",
"def find_files_not(sort)\n files = []\n Find.find(sort) do |path|\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if (tv_file File.basename(path))\n files << path\n end\n files\nend",
"def get_exclusions\n return \"\" if !has_git_ignores? || !has_git? \n git_ignore = File.join PWD, \".gitignore\"\n exclusions = `cat #{git_ignore}`.split(\"\\n\") \n # ensure we remove any commented out .gitignores\n exclusions = exclusions.select { |exclusion| exclusion[0,1] != '#' }\n exclusions = exclusions - @task_config[:always_include] \n if @dry_run\n puts wrap_top(\"EXCLUSIONS:\")\n puts exclusions.join(\"\\n\") \n end\n exclusions\n end",
"def files(folder, ignore)\n all = Dir.glob(folder + \"/**/*\")\n ignore.each {|i| all = all - Dir.glob(i)}\n \n all\n end",
"def getIgnoreFile()\n return @fileAccess.getIgnoreFile()\n end",
"def getListSortWhitoutIgnoredFiles(listPath)\n newListPath = listPath.clone()\n if (!getIgnoreFile().nil?)\n getIgnoreFile().each do | ignoreFile |\n listPath.each do | path |\n if !ignoreFile.nil? and path.match(ignoreFile + \"$\")\n newListPath.delete(path)\n end\n end\n end\n end\n return newListPath\n end",
"def excluded_files_from_config(filepath)\n config = if filepath\n YAML.load_file(config_file)\n else\n {\"excluded\" => []}\n end\n\n excluded_paths = config['excluded'] || []\n\n # Extract excluded paths\n return excluded_paths.\n map { |path| File.join(File.dirname(config_file), path) }.\n map { |path| File.expand_path(path) }.\n select { |path| File.exists?(path) || Dir.exists?(path) }\n end",
"def excludes(*paths)\n self.excluded_files.concat(expand_globs(paths))\n end",
"def net_excluded_directories\n net = []\n all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }\n all.each_with_index do |dir, i|\n unless all[0 ... i].find { |other| dir =~ /^#{other}/ }\n net << dir\n end\n end\n net\n end",
"def net_excluded_directories\n net = []\n all = self.excluded_directories.map { |dir| buildr_project._(dir.to_s) }.sort_by { |d| d.size }\n all.each_with_index do |dir, i|\n unless all[0 ... i].find { |other| dir =~ /^#{other}/ }\n net << dir\n end\n end\n net\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def files\n Dir.glob(bag_dir/\"**\"/\"*\")\n .map {|f| Pathname.new(f) }\n .reject(&:directory?)\n end",
"def apply_exclusions paths\n paths.reject do |path|\n excludes.any? do |pattern|\n globs = pattern.split(\"\\\\\")\n components = path.split(\"/\")\n\n # Inno Setup includes a feature in which you can anchor excludes at\n # the root by starting the exclude with a \"\\\". Since I don't want\n # to make this more complicated than I have to, I'm not implementing\n # this feature at this time.\n if globs[0] == \"\"\n raise \"Can't handle anchored exclude #{pattern}\"\n end\n \n globs_match_strings_anywhere? globs, components\n end\n end\n end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end",
"def skip_paths; end",
"def ignore(*globs)\n @ignore.concat(globs) unless globs.empty?\n @ignore\n end",
"def gitignore_list(dir)\n @gitignore_list ||= {}\n @gitignore_list[dir] ||= []\n\n ilist = []\n if File.exists?(dir + '/.gitignore')\n File.read(dir + '/.gitignore').split(\"\\n\").each do |line|\n Dir[dir + '/' + line].each do |f|\n fn = f.sub(/^#{dir}\\//, '')\n ilist << fn unless ilist.include?(fn)\n end\n end\n end\n @gitignore_list[dir] = ilist\n end",
"def default_excluded_files\n ['config/environment.rb', 'lib/main.rb', 'config/boot.rb', 'bin/IronNails.Library.dll' ].collect{ |dir| \"#{root_path}/#{dir}\" }\n end",
"def exclude_paths(paths=nil)\n if !instance_variable_defined?(:@exclude_paths)\n @exclude_paths = []\n end\n (paths || []).each do |path|\n @exclude_paths << /^(\\w+\\:\\/\\/[^\\/]+\\/?)?#{path.to_s}$/\n end\n @exclude_paths\n end",
"def all_paths\n paths = Dir[\"#{@path}/*\"]\n paths = paths.select(&matcher(options[:accept])) if options[:accept]\n paths = paths.reject(&matcher(options[:reject])) if options[:reject]\n paths\n end",
"def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end",
"def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end",
"def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end",
"def ignores?(file_path)\n !select_matching_file_patterns(ignore_paths, file_path).empty?\n end",
"def ignore(*paths)\n @to_copy -= paths.flatten\n end",
"def _potential_directories\n dirs = []\n dirs << _vim_user_dir\n dirs << _vim_system_dir\n return dirs.compact.map { |dir| File.expand_path(dir) }\n end",
"def ignoring\n %w{*_test.lua *_spec.lua .*}\n end",
"def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end",
"def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end",
"def get_non_flac_paths(source_path)\n non_flac_file_paths = Find.find(source_path).reject {|f| f.end_with?(\".flac\")}\n non_flac_file_paths.reject! {|e| !File.file?(e) }\n return non_flac_file_paths\nend",
"def ignore?(path)\n path = File.absolute_path(path)\n\n dir =\n if File.directory?(path)\n path\n else\n File.expand_path('..', path)\n end\n\n relative_to_home = dir.start_with?(HOME)\n\n if !relative_to_home\n dir = HOME\n end\n\n scan_for_dotignore!(dir)\n\n (@path2dotignore[dir] + @additional_ignores).any? do |pattern|\n Dotsmack::fnmatch?(pattern, path)\n end\n end",
"def check_for_inexistent_files\n inexistent_files = []\n @files.each do |file|\n inexistent_files << file unless File.exists? file\n end\n\n inexistent_files\n end",
"def relative_non_audio_file_paths\n absolute_non_audio_file_paths.map { |p| p.sub(\"#{path.dirname}/\", \"\") }\n end",
"def no_extension_files(base_dir, wildcard, non_exts = [])\n list = []\n unless non_exts.empty?\n list = Dir.glob(File.join(base_dir, wildcard, \"{#{non_exts.join(',')}}\"))\n end\n list\n end",
"def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end",
"def find_command_excludes(from, cwd, exclude_paths)\n exclude_paths.map { |path| \"-not \\\\( -path #{File.join(from, cwd, path)} -prune \\\\)\" }\n end",
"def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n end",
"def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end",
"def ignore_paths\n [/MT/, /\\.mt-attrs/]\n end",
"def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end",
"def ignore!(*globs)\n @ignore.replace(globs)\n @ignore\n end",
"def unix_exclusions\n exclude '/boot'\n exclude '/dev'\n exclude '/etc/fstab'\n exclude '/etc/hosts'\n exclude '/etc/init.d/nova-agent*'\n exclude '/etc/driveclient'\n exclude '/etc/initramfs-tools'\n exclude '/etc/issue'\n exclude '/etc/issue.net'\n exclude '/etc/lvm'\n exclude '/etc/mdadm*'\n exclude '/etc/mtab'\n exclude '/etc/mod*'\n exclude '/etc/network/'\n exclude '/etc/network.d/*'\n exclude '/etc/networks'\n exclude '/etc/rc3.d/S99Galaxy'\n exclude '/etc/resolv.conf'\n exclude '/etc/sysconfig/network'\n exclude '/etc/sysconfig/network-scripts/*'\n exclude '/etc/system-release'\n exclude '/etc/system-release-cpe'\n exclude '/etc/udev'\n exclude '/etc/prelink*'\n exclude '/etc/rc.conf'\n exclude '/etc/conf.d/net'\n exclude '/lib/init/rw'\n exclude '/lib/firmware'\n exclude '/lib/modules'\n exclude '/lib/udev'\n exclude '/root/.rackspace'\n exclude '/mnt'\n exclude '/net'\n exclude '/opt/galaxy/'\n exclude '/proc'\n exclude '/sys'\n exclude '/tmp'\n exclude '/usr/sbin/nova-agent*'\n exclude '/usr/share/initramfs-tools'\n exclude '/usr/share/nova-agent*'\n exclude '/var/cache/yum/*'\n exclude '/var/lib/initramfs-tools'\n exclude '/var/lock'\n exclude '/var/log'\n end",
"def exclusions\n project.exclusions + %w(\n **/.git\n **/.hg\n **/.svn\n **/.gitkeep\n )\n end",
"def ignore_path(relative_path)\n @ignore_paths << Pathname.new(relative_path)\n end",
"def filter(files)\n ruleset.watchlist.filter(files)\n #case ruleset.ignore\n #when Ignore\n # ruleset.ignore.filter(list)\n #when Array\n # list.reject!{ |path| ignore.any?{ |ig| /^#{ig}/ =~ path } }\n #else\n # list\n #end\n end",
"def hiera_file_names\n return @hiera_file_names if @hiera_file_names\n error \"No #{Noop::Config.dir_path_hiera} directory!\" unless Noop::Config.dir_path_hiera.directory?\n exclude = [ Noop::Config.dir_name_hiera_override, Noop::Config.dir_name_globals, Noop::Config.file_name_hiera_plugins ]\n @hiera_file_names = find_files(Noop::Config.dir_path_hiera, Noop::Config.dir_path_hiera, exclude) do |file|\n file.to_s.end_with? '.yaml'\n end\n end",
"def blacklisted_files\n [\n self.class.bin_path\n ]\n end",
"def excluded_file_extensions_for_sync_app\n return @excluded_file_extensions_for_sync_app\n end",
"def ignores_list\n @ignores ||= \"\"\n end",
"def remove_hidden_files(list_of_files)\n\t\tresults = []\n\t\t\n\t\tlist_of_files.each do |file|\n\t\t\t# skip anything with a dot.\n\t\t\tif /^[.]+.*/ =~ file\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\tresults.push file\n\t\t\tend\n\t\tend\n\t\t\n\t\tresults\n\tend",
"def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend",
"def manifest_files\n files = []\n exclude = Regexp.new(PROJ.exclude.join('|'))\n Find.find '.' do |path|\n path.sub! %r/^(\\.\\/|\\/)/o, ''\n next unless test ?f, path\n next if path =~ exclude\n files << path\n end\n files.sort!\nend",
"def ignored_names(ignored)\n modules = Config.read(\"modules\") || []\n ignored.map { |i| modules[i] || \"\" }\n end",
"def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end",
"def entries\n ::Dir.entries(path) - ['.', '..']\n end",
"def site_files\n exclude = %r/tmp$|bak$|~$|CVS|\\.svn/o\n\n rgxp = %r/\\A#{data}\\/?/o\n paths = Hash.new {|h,k| h[k] = []}\n\n Find.find(data) do |p|\n next if exclude =~ p\n\n if test(?d, p)\n paths[p.sub(rgxp, '')]\n next\n end\n dir = ::File.dirname(p).sub(rgxp, '')\n paths[dir] << p.sub(rgxp, '')\n end\n\n paths\n end",
"def ignore_disk_keys()\n ignore_disk_keys = [\n \"disk\",\n \"diskpath\"\n ]\n return ignore_disk_keys\nend",
"def dependent_files\n processed.map(&:abs_path).compact.select { |fn| File.exist?(fn) }\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end",
"def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end"
] | [
"0.74126047",
"0.7255528",
"0.7213519",
"0.7160678",
"0.70518106",
"0.69938236",
"0.6993137",
"0.68540394",
"0.68513554",
"0.6838619",
"0.6829588",
"0.67924213",
"0.67881244",
"0.67821544",
"0.67484546",
"0.6699798",
"0.6698935",
"0.66709304",
"0.6662678",
"0.6628609",
"0.6626839",
"0.6626126",
"0.6611515",
"0.66113406",
"0.6609725",
"0.65971565",
"0.65938413",
"0.6574053",
"0.65692395",
"0.6558141",
"0.65576655",
"0.6513079",
"0.6507858",
"0.64787215",
"0.6463076",
"0.64491636",
"0.6405471",
"0.6381032",
"0.6373969",
"0.6364894",
"0.6249031",
"0.624185",
"0.62328786",
"0.62057847",
"0.6205513",
"0.62040955",
"0.61915517",
"0.61728877",
"0.6147995",
"0.6147995",
"0.61342233",
"0.61282164",
"0.61170024",
"0.6111104",
"0.6101928",
"0.61005247",
"0.6098838",
"0.60850024",
"0.60659957",
"0.6051262",
"0.60505563",
"0.60505563",
"0.6049883",
"0.60498035",
"0.604797",
"0.60461634",
"0.6029628",
"0.6028467",
"0.6025011",
"0.6024667",
"0.6018493",
"0.6007586",
"0.60025376",
"0.59962183",
"0.5989722",
"0.5986303",
"0.59830177",
"0.59645534",
"0.5954199",
"0.595248",
"0.59504896",
"0.5946731",
"0.59432524",
"0.59415746",
"0.5938845",
"0.59194964",
"0.5912745",
"0.5906051",
"0.58889",
"0.58863115",
"0.5873803",
"0.58736616",
"0.58703434",
"0.5860423",
"0.58477527",
"0.58466953",
"0.58413786",
"0.5829542",
"0.5827053",
"0.58155525"
] | 0.71669126 | 3 |
Retrieve repository, overridden in heirs | def retrieve
raise ::NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo\n @repository\n end",
"def repo\n @repo\n end",
"def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend",
"def get_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}\")\n\tend",
"def repo\n if @repo == NRSER::NO_ARG\n @repo = QB::Repo.from_path root_path\n end\n \n @repo\n end",
"def repository\n Repository[self]\n end",
"def repo\n @repo ||= Rugged::Repository.discover('.')\n end",
"def repository\n @repository ||= Repository::Content.new(@base_dir)\n end",
"def repository\n # Match on hostname\n settings.repositories.each do |repository|\n next if repository.cname.nil?\n if repository.cname.upcase == request.host.upcase\n return repository\n end\n end\n \n # If no match, use the first repository as the default\n settings.repositories.first\n end",
"def repository\n @repository ||= Github::Repository.find user: user, name: name\n end",
"def repository\n # Match on hostname\n settings.repositories.each do |repository|\n next if repository.cname.nil?\n if repository.cname.upcase == request.host.upcase\n return repository\n end\n end\n\n # If no match, use the first repository as the default.\n settings.repositories.first\n end",
"def repository\n @repository || model.repository\n end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repository\n raise NotImplementedError\n end",
"def repo\n settings.repo\n end",
"def repo\n read_attribute(:repo).presence || self.original_repo\n end",
"def repository\n defined?(@repository) ? @repository : model.repository\n end",
"def getRepositoryPath\n return @REPOSITORYPATHORSELECT\n end",
"def repository(repo, options = {})\n get Repository.path(repo), options\n end",
"def repositories\n Repositories.instance\n end",
"def repo!\n read_attribute :repo\n end",
"def repository(id)\n repositories[id.to_s]\n end",
"def get_repositories\n get(\"#{url_base}/repositories?#{dc}\")[\"data\"]\n end",
"def repository(id)\n self.repositories.select {|r| r.id == id}.first\n end",
"def repository\n @repository ||= Hash.new\n end",
"def repository; end",
"def repository\n Treasury[self]\n end",
"def repo\n @repo ||= OctocatHerder::Repository.new(@raw['repo'], connection)\n end",
"def repository\n unless Colonel.config.rugged_backend.nil?\n @repo ||= Rugged::Repository.init_at(File.join(Colonel.config.storage_path, id), :bare, backend: Colonel.config.rugged_backend)\n else\n @repo ||= Rugged::Repository.init_at(File.join(Colonel.config.storage_path, id), :bare)\n end\n end",
"def repo\n settings.site_repo \n end",
"def repository(project)\n Grit::Repo.new(project.folder)\n end",
"def repository\n digital_object.repository\n end",
"def repository repoid\n @repos[repoid] or raise \"unknown repository #{repoid.inspect}\"\n end",
"def repository(name_or_file)\n DbAgile::Core::Repository::load(repository_path(name_or_file))\n end",
"def set_repo\n @path = \"#{params[:login].strip}/#{params[:repo].strip}\"\n @repo = CacheRepo.where(path: @path).first\n if !@repo\n @repo = CacheRepo.new(path: @path)\n @repo.save!\n end\n end",
"def default_repository\n ::RightGit::Git::Repository.new('.', DEFAULT_REPO_OPTIONS)\n end",
"def repository\n @options[:repository]\n end",
"def repository\n @options[:repository]\n end",
"def repo_named(full_name)\n pry(Git::Multi.repositories.find { |repo| repo.full_name == full_name })\nend",
"def repository\n @repository ||= repo_type.repository_for(container)\n end",
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def repo_path\n @path\n end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def get_repo_info path=\".\", shell=nil\n defaults = {:type => @scm, :url => @url, :path => path}\n\n defaults.merge self.class.get_info(path, shell)\n end",
"def repository\n return options[:repository] if options.has_key? :repository\n return IO.read(skeleton_dir).strip if skeleton_dir and test(?f, skeleton_dir)\n nil\n end",
"def remote_repository\n url = \"#{configuration[:user]}@#{configuration[:domain]}:\"\n @remote_repository ||= if configuration[:repository].include?(url)\n tmp = configuration[:repository].sub(url, \"file://\")\n if tmp.include?(\"~\")\n tmp.sub!(\"~\", \"/home/#{configuration[:user]}\")\n end\n tmp\n else\n configuration[:repository]\n end\n @remote_repository\n end",
"def get_repos\n\t\t@repos = Repo.all\n\tend",
"def repo_dir; end",
"def repo_root; end",
"def get_repos_by_orga(orga) \n\t\treturn self.fetch(\"repos?owner_name=#{orga}\")\n\tend",
"def find_repos(user)\n user.repos\n end",
"def repo\n return @repo if can_persist?\n return nil\n end",
"def repository_root\n File.expand_path(@repo.path + \"/../\")\n end",
"def repo\n @attributes[:repo]\n end",
"def repo\n @attributes[:repo]\n end",
"def repo\n options[:repo]\n end",
"def get_repo\n raise \"can't get a repo without the repo's full_name (eg. 'fubar/ofxTrickyTrick')\" unless full_name\n\n begin\n response = GithubApi::repository(full_name: full_name)\n rescue => ex\n Rails.logger.debug \"Failed to get repository: #{ex.message} (#{ex.class})\"\n return\n end\n\n unless response.success?\n Rails.logger.debug response.inspect.to_s.red\n return\n\tend\n\n @repo_json = response.parsed_response\n end",
"def get_repo\n repos = get_repos\n unless repos.size == 1\n fail Error.new('unexpected that number of matching repos is not equal to 1')\n end\n\n repos.first\n end",
"def component_repo(cmp)\n component(cmp).fetch('repo', \"#{CONF_DEFAULT_BASE_REPO}/#{cmp}.git\")\nend",
"def component_repo(cmp)\n component(cmp).fetch('repo', \"#{CONF_DEFAULT_BASE_REPO}/#{cmp}.git\")\nend",
"def path\n \"repos/#{@user}/#{name}\"\n end",
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def set_repo\n name = params[:repo].downcase\n @repo = Repo.find_by!(\"LOWER(full_name) = ?\", name)\n end",
"def find_repository\n project = find_project\n json, new_webhook = get_params()\n adapter = BitbucketAdapter.new(json, new_webhook)\n repository = project.repositories.find_by_identifier(adapter.identifier)\n \n if repository\n adapter.update_repository(repository)\n\n elsif Setting.plugin_redmine_bitbucket['auto_create']\n # Clone the repository into Redmine\n repository = adapter.create_repository(project)\n\n else\n raise ActiveRecord::RecordNotFound\n end\n\n return repository\n end",
"def find(local_param)\n if repo = list.find { |r| r.param == local_param }\n repo\n else\n refresh\n repo = list.find { |r| r.param == local_param }\n raise Ginatra::RepoNotFound if repo.nil?\n repo\n end\n end",
"def repository\n bond.repository\n end",
"def repository(name)\n @repository_model.find_by name: name\n # TODO: raise custom error that can be rescued up stack, return http\n # response with proper error message\n rescue Mongoid::Errors::DocumentNotFound => e\n raise e.message\n end",
"def getRepositoryFile\n return @REPOSITORYFILEORFIELD\n end",
"def repositories\n opts[:repositories]\n end",
"def repository\n repo = RepositoryManager.for(repository_key)\n return repo unless repo.nil?\n # we haven't got a key lets try and make one\n begin\n RepositoryManager.create(repository_key)\n rescue NameError\n raise NameError, \"Could not create #{repository_key}\", caller[2..-1]\n end\n end",
"def repos\n pry(Git::Multi.repositories)\nend",
"def execute\n get_repo(repo_name).repo.fetch\n end",
"def [](name)\n repositories.fetch(name)\n end",
"def git\n @git ||= Grit::Repo.new(path)\n end",
"def git\n @git ||= Grit::Repo.new(path)\n end",
"def set_repo\n @repo = Repo.find(params[:id])\n end",
"def set_repo\n @repo = Repo.find(params[:id])\n end",
"def set_repo\n @repo = Repo.find(params[:id])\n end",
"def set_repo\n @repo = Repo.find(params[:id])\n end",
"def remote_repository\n \"http://www.aQute.biz/repo\"\n end",
"def fetch_repository(payload)\n repo_path = repository_path(payload)\n if(File.directory?(repo_path))\n debug \"Pulling changes to: #{repo_path}\"\n repo = Git.open(repo_path)\n repo.checkout('master')\n repo.pull\n repo.fetch\n else\n debug \"Initiating repository clone to: #{repo_path}\"\n Git.clone(github_url(payload), repo_path)\n end\n repo_path\n end",
"def repository_name\n Repository.context.any? ? Repository.context.last.name : default_repository_name\n end",
"def repos\n @repos ||= OY.repos\n end",
"def method_missing(name, *)\n repositories.fetch(name) { super }\n end",
"def uri\n \"file://\" + self.repos_path\n end",
"def set_repository\n @repository = Repository.find(params[:id])\n end",
"def set_repository\n @repository = Repository.find(params[:id])\n end",
"def set_repository\n @repository = Repository.find(params[:id])\n end",
"def set_repository\n @repository = Repository.find(params[:id])\n end",
"def repository\n RubyAem::Resources::Repository.new(@client)\n end",
"def bare_repo\n #puts 'bare_repo', dir.to_s + '.cr.git'\n @bare_repo ||= Git::Base.bare(dir.to_s + '.cr.git')\n end",
"def svn_repository\n return @svn_repository if @svn_repository\n \n @svn_repository = DmSvn::Model.first(:name => self.name)\n @svn_repository ||= DmSvn::Model.create(:name => self.name, :revision => 0)\n @svn_repository.config = config\n @svn_repository\n end",
"def repositories\n octokit.repositories('zold-io').map { |json| json['full_name'] }\n end",
"def repository!\n Repository.find_or_create_by!(url: repository_url) do |repo|\n repo.organization_id = org_id\n repo.name = repository_name\n end\n end",
"def find_repositories\n @repos = GithubApi.call :repos\n end"
] | [
"0.7654918",
"0.7592961",
"0.7547123",
"0.7491363",
"0.7395462",
"0.73763555",
"0.73217225",
"0.72534597",
"0.7244503",
"0.71883225",
"0.71850014",
"0.7154713",
"0.71432525",
"0.71432525",
"0.71432525",
"0.71432525",
"0.7119365",
"0.71095735",
"0.71021867",
"0.7088122",
"0.70653635",
"0.7052647",
"0.7051027",
"0.6962543",
"0.69557303",
"0.6951304",
"0.69458824",
"0.69380003",
"0.6913294",
"0.690882",
"0.6906472",
"0.6886994",
"0.6860172",
"0.68529403",
"0.68189514",
"0.6767325",
"0.6729364",
"0.6716855",
"0.66759866",
"0.6668711",
"0.6668711",
"0.66509694",
"0.66395134",
"0.66298425",
"0.6628992",
"0.66280025",
"0.66280025",
"0.66280025",
"0.66280025",
"0.6620841",
"0.6616417",
"0.6615258",
"0.6580965",
"0.65667015",
"0.65578794",
"0.6553935",
"0.6512303",
"0.65096474",
"0.6508962",
"0.65037715",
"0.65037715",
"0.6486881",
"0.6478664",
"0.64774626",
"0.64701134",
"0.64701134",
"0.64583486",
"0.6458333",
"0.644433",
"0.6442483",
"0.64334553",
"0.641413",
"0.6413998",
"0.6383439",
"0.6382495",
"0.63814247",
"0.63813996",
"0.63761324",
"0.637134",
"0.634975",
"0.634975",
"0.6349028",
"0.6349028",
"0.6349028",
"0.6349028",
"0.6335724",
"0.6326191",
"0.62981296",
"0.628465",
"0.6269742",
"0.6262741",
"0.6256676",
"0.6256676",
"0.6256676",
"0.6256676",
"0.6228936",
"0.62194926",
"0.61915505",
"0.61908853",
"0.6189917",
"0.6189415"
] | 0.0 | -1 |
Because the edit action need to be done also without authorization. | def new
@user = current_user_obj
authorize! :update, @user
@user.send_email_confirmation(current_area_translated, current_website_translated)
redirect_to root_path, :notice => t(:new_email_confirmation_sent)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n require_user\n end",
"def edit\n authorize! :update, @user\n end",
"def edit\n enforce_update_permission(@user)\n end",
"def edit\n\t\t# must have admin access or be in the course\n\tend",
"def edit\n authorize @user_information\n end",
"def edit\n authorize! :edit, @user, :id => current_user.id\n end",
"def edit\n @user = current_user\n\n authorize! @tool\n end",
"def edit\n #Nothing necessary\n end",
"def edit\n\t\tadd_breadcrumb \"Editar\"\n\t\tif @request.user_id != current_user.id\n\t\t\tredirect_to root_path, alert: \"Usted no es el creador de la solicitud, por lo que no puede modificarla. Contáctese con su administrador.\"\n\t\tend\n\tend",
"def edit\n \n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end",
"def edit\n redirect_to root_url and return unless current_user\n @user = current_user\n end",
"def edit\n authorize @volunteer_position\n end",
"def edit\n authorize @car\n end",
"def edit\r\n end",
"def edit\r\n \r\n end",
"def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n\t\t\n\tend",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n authorize! :edit, @user\n respond_with(@user)\n end",
"def edit\n @user = User.find(params[:id])\n authorize! :update, @user \n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] | [
"0.8098426",
"0.7918531",
"0.78296614",
"0.78225213",
"0.7739271",
"0.77195287",
"0.7682463",
"0.767167",
"0.7661527",
"0.7632697",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75883645",
"0.75689965",
"0.7563938",
"0.7559525",
"0.75581485",
"0.75411075",
"0.75287414",
"0.7525206",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.75161296",
"0.7508992",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.7500792",
"0.74984163",
"0.74927115",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973",
"0.7485973"
] | 0.0 | -1 |
+options[:result]+ can be a result from Trackerfind_call. Otherwise, it can be +nil+. | def initialize options = {}
@view_name = nil
OPTIONS.each do |key, var|
self.instance_variable_set(var, options[key])
end
self.confidence = options[:confidence]
result = options[:result]
if result
@code ||= result[:call]
@file ||= result[:location][:file]
if result[:location][:type] == :template # template result
@template ||= result[:location][:template]
else
@class ||= result[:location][:class]
@method ||= result[:location][:method]
end
end
if @method.to_s =~ /^fake_filter\d+/
@method = :before_filter
end
if @user_input.is_a? Railroader::BaseCheck::Match
@user_input_type = @user_input.type
@user_input = @user_input.match
elsif @user_input == false
@user_input = nil
end
if not @line
if @user_input and @user_input.respond_to? :line
@line = @user_input.line
elsif @code and @code.respond_to? :line
@line = @code.line
end
end
if @gem_info
if @gem_info.is_a? Hash
@line ||= @gem_info[:line]
@file ||= @gem_info[:file]
else
# Fallback behavior returns just a string for the file name
@file ||= @gem_info
end
end
unless @warning_set
if self.model
@warning_set = :model
elsif self.template
@warning_set = :template
@called_from = self.template.render_path
elsif self.controller
@warning_set = :controller
else
@warning_set = :warning
end
end
if options[:warning_code]
@warning_code = Railroader::WarningCodes.code options[:warning_code]
end
Railroader.debug("Warning created without warning code: #{options[:warning_code]}") unless @warning_code
@format_message = nil
@row = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_set_options(result, options)\n result = api_added(result, options[:added]) if options[:added]\n return result\n end",
"def set_result\n results = result_params\n unless results.nil?\n if results.is_a?(String)\n parts = results.split(\"#\")\n @result = @measurement.results.find(parts[0].to_i)\n end\n end\n end",
"def get_result(result_type) ; add_result(result_type, false) ; end",
"def lookup(options)\n raise 'todo'\n end",
"def use_result\n store_result\n end",
"def lookup(options={})\n send_message(SkyDB::Message::Lookup.new(options))\n return nil\n end",
"def set_result\n @result = Api::V1::Result.find(params[:id])\n end",
"def find_answer(options={})\n\toptions[:answer]\nend",
"def find_each_result(options = {})\n return enum_for(:find_each_result, options) unless block_given?\n\n find_results_in_batches options do |batch|\n batch.each do |result|\n yield result\n end\n end\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result_info\n @result_info = ResultInfo.find(params[:id])\n end",
"def store_result(result); end",
"def result?; end",
"def set_result\n @result = Result.new\n end",
"def find_by_name type_name, option\n begin\n found = eval type_name.to_s, binding, __FILE__, __LINE__\n finish_and_make_successful_result [found], option\n rescue NameError \n make_failed_result type_name\n end\n end",
"def list_results(**opt)\n # May be overridden by the subclass.\n end",
"def make_result_info\n end",
"def find_answer(answer: nil, **opts)\n answer\n end",
"def store_result()\n #This is a stub, used for indexing\n end",
"def options\n validate_or_get_results :options\n end",
"def run(result)\n false\n end",
"def add_result name, res\n \n end",
"def set_result\n @result = Admin::Result.find(params[:id])\n end",
"def initialize(result)\n @result = result\n end",
"def initialize(result)\n @result = result\n end",
"def initialize(result)\n @result = result\n end",
"def result\n results.first\n end",
"def initialize(options = {})\n @options = {\n :never_sets_result => nil,\n :never_rises_result => nil,\n :zenith => DEFAULT_ZENITH,\n }.merge(options)\n end",
"def process_result(player, result)\n result_object = nil\n self.results.to_a.each do |result|\n if result.player == player\n result_object = result\n end\n end\n result_object.value = result\n result_object.save!\n calculate\n end",
"def display(results, options = T.unsafe(nil)); end",
"def query_result(filter_prefs = {}, options = {})\n options ||= {} # in case options is nil\n sample_option = options[:sample_option]\n sql_string = options[:sql_string]\n\n case sample_option\n when self.class::Sample::PORTAL\n raise 'tabular sample data from portal not implemented'\n when self.class::Sample::REMOTE_JSON\n raise 'JSON sample data from remote web service not implemented'\n when self.class::Sample::REMOTE\n @query_result ||= QueryResult.find(self.id, :params =>\n {\n :sql_string => token_replaced_sql_string(sql_string, filter_prefs),\n :sample_option => sample_option\n }\n )\n when self.class::Sample::PORTAL_JSON\n @query_result = QueryResult.new(\n :result_set => ResultSet.new(\n :result_type => 'json',\n :latest_data_results =>\n (self.sample_data.present? ? [self.sample_data] : [])\n )\n )\n else # nil or Query::Sample::REAL\n if self.query_result_id.nil?\n @query_result = nil\n else\n @query_result ||= QueryResult.find(self.query_result_id, :params =>\n {\n :query_string => self.token_replaced_hive_query_string,\n :sql_string => token_replaced_sql_string(sql_string, filter_prefs)\n }\n )\n end\n end\n @query_result\n end",
"def construct_if_found(results)\n unless results.blank?\n new(results)\n else\n nil\n end\n end",
"def result=(r)\n\n fields['__result__'] = r\n end",
"def search(options)\n result = case options\n when MatchData\n options.to_s\n when Hash\n if options.include?(:all)\n option_search_all(options).join(' ')\n else\n search_file_with_pattern(:pattern => options[:test_for][1], :in_dir => options[:in_dir])\n end\n end\n end",
"def single_result(results)\n result = results.first\n\n result.meta = results.meta\n\n result.linked_data = results.linked_data if results.respond_to? :linked_data\n\n return result\n end",
"def find(options={})\n query(options)\n end",
"def notify_results(output, options)\n results = parse_output(output)\n Notifier.notify_results(results)\n end",
"def get_result\n\t\texecute unless @result\n\t\treturn @result\n\tend",
"def adapt_result(result)\n if pre_simplecov_0_18_result?(result)\n adapt_pre_simplecov_0_18_result(result)\n else\n result\n end\n end",
"def update!(**args)\n @results = args[:results] if args.key?(:results)\n end",
"def update!(**args)\n @results = args[:results] if args.key?(:results)\n end",
"def result_info=(value)\n @result_info = value\n end",
"def result_info=(value)\n @result_info = value\n end",
"def perform(options = nil)\n return if options.nil? || options['cursor'] == 0\n authentication = Authentication.find(options['authentication_id'])\n\n fetch_social_friend_uids_service = FetchSocialFriendUids.call(\n authentication: authentication,\n cursor: options['cursor']\n )\n\n if fetch_social_friend_uids_service.valid? && fetch_social_friend_uids_service.response.count > 0\n FollowSocialUids.call(\n authentication: authentication,\n uids: fetch_social_friend_uids_service.response.map(&:to_s)\n )\n\n next_cursor = fetch_social_friend_uids_service.response.attrs[:next_cursor]\n FollowTwitterFriendsWorker.perform_async(\n authentication_id: authentication.id,\n cursor: next_cursor\n ) if next_cursor > 0\n end\n end",
"def find!\n @total_found = 0\n @results = nil\n return results\n end",
"def api_call(method,options={})\n debug(6,:msg=>\"Method\",:var=>method)\n debug(6,:msg=>\"Options\",:var=>options)\n\n obj=json_obj(method,options)\n result=do_request(obj)\n if @returntype==:result\n result[\"result\"]\n else\n result.merge!({:method=>method, :params=>options})\n @returntype.new(result)\n end\n end",
"def initialize(options, info)\n\n options.each do |key, value|\n\n case key\n\n # =====================================================================\n # View\n # =====================================================================\n\n when 'view' # NOTE: 0% coverage for this case\n value = value.to_s.downcase\n @View = (value if info.available_result_list_views.include?(value))\n\n # =====================================================================\n # Results per page\n # =====================================================================\n\n when 'rows', 'per_page', 'results_per_page'\n @ResultsPerPage = [value.to_i, info.max_results_per_page].min\n\n # =====================================================================\n # Row offset\n # =====================================================================\n\n when 'start' # Solr starts at row 0.\n @Offset = value.to_i + 1\n\n # =====================================================================\n # Page number\n # =====================================================================\n\n when 'page', 'page_number'\n @PageNumber = value.to_i\n\n # =====================================================================\n # Highlight\n # =====================================================================\n\n when 'highlight' # NOTE: 0% coverage for this case\n @Highlight = value.to_s\n\n when 'hl' # Solr/Blacklight version\n # API bug: if set to 'n' you won't get research starter abstracts!\n @Highlight = (value == 'on') ? 'y' : 'y'\n\n # =====================================================================\n # Image quick view\n # =====================================================================\n when 'include_image_quick_view'\n @IncludeImageQuickView = value ? 'y' : 'n'\n\n # =====================================================================\n # Anything else\n # =====================================================================\n\n else\n Rails.logger.debug {\n \"EDS RetrievalCriteria: ignoring param #{key} = #{value.inspect}\"\n }\n\n end\n\n end\n\n # Resolve page versus offset.\n @PageNumber ||= (@Offset / @ResultsPerPage) + 1 if @Offset\n\n # Apply defaults where values where not explicitly given.\n @IncludeImageQuickView ||= info.default_include_image_quick_view\n @View ||= info.default_result_list_view\n @ResultsPerPage ||= info.default_results_per_page\n @PageNumber ||= 1\n\n end",
"def find_tracking_info(tracking_number, options = {})\n options = @options.merge(options)\n parse_tracking_response(tracking_number, options)\n end",
"def find_tracking_info(tracking_number, options = {})\n options = @options.merge(options)\n parse_tracking_response(tracking_number, options)\n end",
"def find_tracking_info(tracking_number, options = {})\n options = @options.merge(options)\n parse_tracking_response(tracking_number, options)\n end",
"def find_tracking_info(tracking_number, options = {})\n options = @options.merge(options)\n parse_tracking_response(tracking_number, options)\n end",
"def retrieve(options)\n response = client.get(RETRIEVE_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_detailed_address_from(response.items.first)\n end",
"def result\n meta.fetch(:result, :one)\n end",
"def update!(**args)\n @result = args[:result] if args.key?(:result)\n end",
"def update!(**args)\n @result = args[:result] if args.key?(:result)\n end",
"def update!(**args)\n @result = args[:result] if args.key?(:result)\n end",
"def fetch(options = {})\n\n url = build_url(options)\n\n puts \"this is the url #{url}\"\n puts \"these are the options #{options}\"\n\n json = get_response(url)\n\n puts json.to_yaml\n\n data = JSON.parse(json)\n\n #puts \"dump data after parse: #{data.to_yaml}\"\n\n # Check to see if the api returned an error\n raise ApiError.new(data['details'],url) if data.has_key?('problem')\n\n\n if !options[:id]\n\n puts \"in options\"\n\n collection = RMeetup::Collection.build(data)\n\n #puts \"value of collection:#{collection.to_yaml}\"\n\n # Format each result in the collection and return it\n collection.map!{|result| format_result(result)}\n\n return collection\n else\n puts \"not in options\"\n return data\n\n end\n\n\n end",
"def results opts ={}\n defaults = { :print => nil, :verbose => nil }\n\n print = opts[:print] || defaults[:print]\n verbose = opts[:verbose] || defaults[:verbose]\n\n get_results if @parsed_results == nil\n \n if print\n @output << @request.full\n @output << @parsed_results\n end\n \n if verbose\n puts @raw_results\n end\n\n @parsed_results\n\n end",
"def initialize(options, info)\n\n options.each do |key, value|\n\n case key\n\n # =====================================================================\n # View\n # =====================================================================\n\n when 'view'\n value = value.to_s.downcase\n @View = (value if info.available_result_list_views.include?(value))\n\n # =====================================================================\n # Results per page\n # =====================================================================\n\n when 'rows', 'per_page', 'results_per_page'\n @ResultsPerPage = [value.to_i, info.max_results_per_page].min\n\n # =====================================================================\n # Page number\n # =====================================================================\n\n when 'page', 'page_number'\n @PageNumber = value.to_i\n\n # =====================================================================\n # Row offset\n # =====================================================================\n\n when 'start'\n @Offset = value.to_i + 1 # Solr starts at row 0; EBSCO at row 1.\n\n # =====================================================================\n # Highlight\n # =====================================================================\n\n when 'highlight'\n @Highlight = value.to_s\n\n when 'hl' # Solr/Blacklight version\n @Highlight = (value == 'on') ? 'y' : 'n'\n\n # =====================================================================\n # Image quick view\n # =====================================================================\n\n when 'include_image_quick_view'\n @IncludeImageQuickView = value ? 'y' : 'n'\n\n # =====================================================================\n # Anything else\n # =====================================================================\n\n else\n Log.debug {\n \"EDS RetrievalCriteria: ignoring param #{key} = #{value.inspect}\"\n }\n\n end\n\n end\n\n # API bug: if set to 'n' you won't get research starter abstracts!\n @Highlight = 'y' unless @Highlight.nil?\n\n # Resolve page versus offset.\n @PageNumber ||= (@Offset / @ResultsPerPage) + 1 if @Offset\n\n # Apply defaults where values where not explicitly given.\n @IncludeImageQuickView ||= info.default_include_image_quick_view\n @View ||= info.default_result_list_view\n @ResultsPerPage ||= info.default_results_per_page\n @PageNumber ||= 1\n\n end",
"def populate_options\n \tself.results = HTTP.auth(self.bearer_token).get(search_url, params: search_params).parse\n\tend",
"def get_original_result\n non_pr_results.first\n end",
"def find_with(results, with = nil)\n ret = QueryResult.new\n ret << results if results\n ret << with if with\n ret.flatten!\n\n ret.size == 1 ? ret[0] : ret\n end",
"def apply_result(result)\n case result\n when FromScrimmageResult\n @field_position += result.yards_gained\n\n if @field_position >= 100\n touchdown\n elsif @field_position >= @line_to_gain\n first_down\n elsif @field_position <= 0\n safety\n elsif result.repeat_down\n # No-op\n else\n @down += 1\n if @down > 4\n turnover\n end\n end\n\n when OnePointConversionResult\n if result.success\n score(1)\n end\n kickoff\n\n when TwoPointConversionResult\n if result.success\n score(2)\n end\n kickoff\n\n when FieldGoalResult\n if result.success\n score(3)\n kickoff\n else\n change_of_possession\n new_downs\n end\n\n when ReturnableKickResult\n # This handles all three types of returnable kicks\n @field_position += result.kick_distance\n change_of_possession\n\n if result.touchback\n @field_position = result === KickoffResult ? 25 : 20\n else\n @field_position += result.return_distance\n end\n\n # Now check for a TD or safety\n # TODO dedup with scrimmage logic\n if @field_position >= 100\n touchdown\n elsif @field_position <= 0\n safety\n else\n new_downs\n end\n\n when TakeawayResult\n turnover\n @field_position += result.taking_team_yards_gained\n\n if @field_position >= 100\n touchdown\n elsif @field_position <= 0\n # touchback\n # TODO can there be a safety on a takeaway? technically i think yet but very rare\n @field_position = 20\n first_down\n end\n\n else\n raise \"unknown result type #{result.class}\"\n\n end\n\n # advance the clock\n # TODO two minute warning?\n @seconds_remaining -= result.seconds_elapsed\n if (@seconds_remaining <= 0) && (@play_type != :point_after_touchdown)\n @quarter += 1\n @seconds_remaining = 15 * 60\n\n if @quarter == 3\n puts \"--> End of half\"\n @possession = AWAY\n kickoff\n end\n end\n end",
"def result_for label\n val = results&.result_for label\n # If passed a block, call the block on the value\n yield(val) if val && block_given?\n val\n end",
"def method_missing namesym, *args\n results&.send namesym, *args\n end",
"def run(results)\n if(use_multiple?(results))\n results = run_multiple(results)\n else\n results = run_single(results)\n end\n return results\n end",
"def run\n options = {\n \"n\" => {\n helper: \"Name of module\",\n value: ''\n },\n }\n\n name = ''\n # Option set name\n if @opts.length == 2\n if options.key?(@opts[0])\n name = @opts[1].to_s\n \n else\n @graph_com.display(12, \"Option [#{@opts[0]}] of list_result does not exists.\")\n return\n end\n end\n\n results = AnalyseResult.only(:module_name, :created_at)\n unless results.empty?\n display_results(results, name)\n\n else # ... \"No generated result matching\"\n @graph_com.display(12, \"No result generated, use a module before.\")\n end\n end",
"def find(options)\n BorrowDirect::FindItem::Response.new find_item_request(options), self.auth_id\n end",
"def set_task_result\n @task_result = TaskResult.find(params[:id])\n end",
"def set_task_result\n @task_result = TaskResult.find(params[:id])\n end",
"def competitor_result(competitor)\n if competitor.has_result?\n competitor.external_result.try(:details)\n end\n end",
"def method_missing method, *args, &block\n @results.send(method, *args, &block)\n end",
"def set_result(opts)\n self.home_score = opts[:home_score]\n self.away_score = opts[:away_score]\n self.winner = self.home_score > self.away_score ? self.home : self.away\n self.finished = true\n end",
"def query_result(**args)\n solr_service.query_result(build, **args)\n end",
"def follow(options = T.unsafe(nil)); end",
"def choose_track(deezer_response, artist, title)\n case deezer_response.count\n when 1\n searched_songs_mapping(deezer_response).first\n when 0\n puts(\"Track #{artist} - #{title} not found in Deezer.\", @puts_args)\n nil\n else\n searched_songs_mapping(deezer_response).select do |track|\n TextHelper.names_similar?(track[:artist].downcase, artist.downcase) &&\n TextHelper.names_similar?(track[:title].downcase, title.downcase)\n end.first\n end\n end",
"def set_user_result\n @user_result = UserResult.find(params[:id])\n end",
"def fetch_results(which_q, subreddit, which_to)\n results = which_to.call(subreddit.name, subreddit.item_limit)\n @l.info \"results fetched from #{subreddit.name}::#{which_q}\"\n results.nil? ? results = [] : results = results \n results\n end",
"def add(name, options = {}, &block)\n method = name.to_s + \"?\"\n @results.delete(name)\n\n meta_def(method) do\n # we return a cached result if:\n # * if we've tested this feature before\n # AND\n # * the result was true/false\n # OR\n # * we're configured to never retry\n if @results.has_key?(name) &&\n (!@results[name].nil? || !Puppet[:always_retry_plugins])\n !!@results[name]\n else\n @results[name] = test(name, options, &block)\n !!@results[name]\n end\n end\n end",
"def result_for (label)\n (results = @results[label]) && # There are results for this tag\n results.first && # First hash in the list of results\n results.first.out[0]\n end",
"def method_missing(method, *args, &block)\n @results ||= self.fetch!\n @results.send(method)\n end",
"def run(options = {})\n options = set_defaults(options)\n validations(options)\n @run_options = options\n\n puts \"Routing options: #{options}\" if options[:debug]\n\n begin\n @result = results_query.to_a\n @path = path_class.new @result\n rescue => e\n @errors << \"#{e}: #{e.backtrace}\"\n return false\n end\n\n true\n end",
"def run(options = {})\n options.reverse_merge(per: 10, page: 1, result_type: :record) # Smaller number for console testing.\n TraitBank.term_search(self, options)[:data]\n end",
"def result\n results[0]\n end",
"def run(reporter, options = T.unsafe(nil)); end",
"def set_search_results(type = nil)\n valid_values = SearchModesHelper::SEARCH_RESULTS\n set_search_feature(:results, type, valid_values, meth: __method__)\n end",
"def nil_or_object(result, klass)\n result.null? ? nil : klass.new(result)\n end",
"def findOrCreate(args, options = {})\n # attempt to find the record\n res = get_cached(args)\n\n # on failure, do\n unless res\n args.merge!(options)\n res = self.new(args).save!\n\n # Update cache\n cache_key = gen_cache_key(args)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, Octo::Utils.serialize(res))\n end\n res\n end",
"def run!(**options)\n interaction = run(options)\n raise error_class.new(interaction.error) unless interaction.success?\n interaction.result\n end",
"def store_finder_results_label\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.p.className(create_ats_regex_string(\"ats-storefinderresultslbl\")), format_method(__method__))\n end"
] | [
"0.6277903",
"0.60746485",
"0.59010714",
"0.5773727",
"0.57560915",
"0.55166936",
"0.54389775",
"0.5437488",
"0.5430641",
"0.5425937",
"0.5425937",
"0.5425937",
"0.5425937",
"0.5425937",
"0.5425937",
"0.5425937",
"0.5425937",
"0.5425937",
"0.542587",
"0.5402812",
"0.53893906",
"0.5383916",
"0.53584033",
"0.5331928",
"0.5318721",
"0.5257494",
"0.52439773",
"0.524287",
"0.5232632",
"0.5221586",
"0.5210087",
"0.5208023",
"0.5180135",
"0.5169775",
"0.5166848",
"0.5166848",
"0.5166848",
"0.51665956",
"0.51611525",
"0.5153629",
"0.5149059",
"0.5132482",
"0.5102265",
"0.5090011",
"0.5078344",
"0.50628984",
"0.50618196",
"0.5060433",
"0.50426656",
"0.504176",
"0.5037473",
"0.5037473",
"0.5023017",
"0.5023017",
"0.5020808",
"0.4992692",
"0.49789",
"0.49774227",
"0.49745512",
"0.49745512",
"0.49745512",
"0.49745512",
"0.49595845",
"0.495835",
"0.49529326",
"0.49529326",
"0.49529326",
"0.4946109",
"0.49404588",
"0.4929622",
"0.492617",
"0.4923333",
"0.4916497",
"0.49159494",
"0.4903363",
"0.4902807",
"0.48997402",
"0.48867068",
"0.48846227",
"0.48809674",
"0.48809674",
"0.48789564",
"0.48756427",
"0.4875566",
"0.48706707",
"0.4870016",
"0.48698336",
"0.48642886",
"0.48606864",
"0.48567072",
"0.4848791",
"0.4844499",
"0.48387313",
"0.48278424",
"0.4826478",
"0.48259714",
"0.48248577",
"0.48229492",
"0.48156914",
"0.48095277",
"0.4806917"
] | 0.0 | -1 |
Returns name of a view, including where it was rendered from | def view_name(include_renderer = true)
if called_from and include_renderer
@view_name = "#{template.name} (#{called_from.last})"
else
@view_name = template.name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_name\n @view.virtual_path.split('/').last\n end",
"def view_name\n self.class.view_name\n end",
"def view\n self.class.name.underscore\n end",
"def get_name(task_name)\n @view.get_name(task_name)\n end",
"def view_path\n @@view_path\n end",
"def view_path\r\n @view_name ||= File.basename(self.class.to_s.gsub(/Proxy$/, '').underscore).to_sym\r\n path = \"#{APP_ROOT}/views/#{view_name}.xaml\"\r\n @view_path = path unless @view_path == path\r\n @view_path\r\n end",
"def template_name name = nil\n name ||= @current_method\n name = name.to_s\n if name.include? \"/\"\n name\n else\n controller = @current_class.to_s.gsub(\"Controller\", \"\")\n controller.gsub!(\"::\", \"/\")\n underscore(controller + \"/\" + name.to_s)\n end\n end",
"def view_path(file_name)\n File.join(\"app\", \"views\", \"#{self.class.name.gsub(\"Controller\",\"\").downcase}\", file_name)\n end",
"def view_class_name\n view_class_components.join('_').camelize.sub(/^Layouts/, '')\n end",
"def unique_filename(name)\n File.join(VIEW_PATH, \"#{name}.erb\")\n end",
"def view_names\n self['views'].keys\n end",
"def view_path\n File.join path, 'views'\n end",
"def path_to_view view\n paths_to_view(view).first\n end",
"def view_path\n @view_path ||= root + \"/views\"\n end",
"def view_model_path\n @view_model_path || @view_model_path = self.name.underscore\n end",
"def name\n self.class.to_s.gsub(/controller$/i, \"\")\n end",
"def template_name; end",
"def template_name; end",
"def template_file_name\n File.join(['structure', \"views\", \"#{controller_name}.html\"])\n end",
"def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end",
"def controller_view_path\n ivar_cache do\n Mack::Paths.views(self.controller.controller_name)\n end\n end",
"def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend",
"def controller_name\n self.request.route_obj.instance_variable_get('@controller')\n end",
"def action_name\n name = self.request.route_obj.instance_variable_get('@named').to_s\n name.gsub!(/^#{controller_name}_?/, '')\n name = 'index' if name == ''\n name\n end",
"def path_name\n @parent ? \"#{@parent.path_name}.#{name}\" : name\n end",
"def displayname\n path\n end",
"def name\n @name || path_name\n end",
"def find_view_holder\n\n view_holder_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-viewholder-#{view.render}.erb\",'template','cms') \n \n if not view_holder_path\n path = context.get_path(\"#{frontend_skin_preffix}render-viewholder-#{view.model_name}-#{view.render}\")\n view_holder_path = path if not path.nil? and File.exists?(path)\n end\n\n return view_holder_path\n\n end",
"def template_name\n self.path.scan(/[^\\/]+$/).first\n end",
"def set_view_name\n\n if !(session[:generic_view_name].nil?)\n\n @view_name = session[:generic_view_name]\n\n else\n\n error_log(\"session[:generic_view_name] was nil\",2)\n\n end\n\n end",
"def resolve_template_path(name)\n controller_name = self.class.name.gsub(/Controller$/, '').downcase\n return \"views/#{controller_name}/#{name}.html.erb\"\n end",
"def views_path\n (RUBYCOCOA_ROOT + 'app/views').to_s\n end",
"def self_path\n caller_locations(1,1)[0].label.to_s.camelize(:lower)\n end",
"def screen_name\n controller_name = t(\"controllers.#{params[:controller]}\").upcase\n action_name = t(\"actions.controllers.#{params[:action]}\").upcase\n \"#{controller_name} / #{action_name}\"\n end",
"def path_for_view(view)\n view = view.class unless view.is_a?(String) or view.is_a?(Class)\n view = view.name.to_s.sub(/Controller$/, '') if view.is_a? Class\n \"#{views_path}/#{view.camel_case}.nib\"\n end",
"def name\n @name ||= Rails.application.class.parent_name.underscore\n end",
"def template_filename\n @template_filename ||= self.class.name.split('::').last + -'.html.erb'\n end",
"def self_path\n caller_locations(1,1)[0].label.to_s.camelize\n end",
"def view_dir(view)\n\treturn \"#{$ccase_root}/#{view}\"\nend",
"def name\n parent_uri = self.parent.uri.to_s\n if not parent_uri.end_with?(\"/ROs/\")\n # Evil hack\n parent_uri += \"/ROs/\"\n end\n return URI.parse(parent_uri).route_to(self.uri.to_s).to_s\n end",
"def view\n @_view\n end",
"def info_header_fname\n \"_#{name.downcase}_info.html.erb\"\n end",
"def name_for_path\n is_alias_for ? is_alias_for.full_name : full_name\n end",
"def template_path(name)\n name = name.to_s\n if name.include?('/') # Specific path like 'representers/somethingorother/foo.haml' given.\n name\n else\n File.join(self.class.representer_path, name)\n end\n end",
"def info_fname\n \"_#{name}_info.html.erb\"\n end",
"def template_module_name(path); end",
"def hookname(context)\n context[:controller].send(:render_to_string, {:locals => context, :partial => '_view_file'})\n end",
"def controller_name\n self.class.controller_name\n end",
"def name_for_path\n full_name\n end",
"def inspect\n \"#<#{self.class.name}:##{self.path_name}>\"\n end",
"def name\n return \"#{self.root.name} #{@type}\"\n end",
"def js_class_name\n action = \n case action_name\n when 'create' then 'New'\n when 'update' then 'Edit'\n else action_name\n end.camelize\n \"Views.#{self.class.name.gsub('::', '.').gsub(/Controller$/, '')}.#{action}View\"\n end",
"def display_name\n @_context[:display_name]\n end",
"def get_view(viewname, params = nil)\n raise \"get_view not implemented\"\n end",
"def template_name\n name.split(\"::\").last.downcase.gsub(/onebox/, \"\")\n end",
"def fp(arg)\n File.join(ABS_RAILS_ROOT, 'app', 'views-per-site', arg)\n end",
"def representer_path\n name.underscore\n end",
"def rendered_action_name\n\t\t@rendered_action || params[:action]\n\tend",
"def current\n ActiveSupport::StringInquirer.new(@params[:view].is_a?(Array) ?\n @params[:view].join(\"\") :\n @params[:view].to_s)\n end",
"def get_views()\n gen_config.views.map(&:name)\n end",
"def view_paths; end",
"def view_paths; end",
"def view_paths; end",
"def set_common_view_name\n @view_name = \"message_view\"\n @params = params\n end",
"def name\n @name ||= path.split('/').last\n end",
"def to_partial_path\n \"alchemy/elements/#{name}_view\"\n end",
"def name()\n if bound?\n return bound_name\n end\n if label && label.match(/[a-zA-Z][a-zA-Z0-9_]*/) != nil\n return label\n end\n return uri.split(/(\\/|#)/).last\n end",
"def script_name\n return @request.script_name\n end",
"def find_view_render_template(view)\n \n view_template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-view-#{view.render}.erb\",'template','cms')\n \n if not view_template_path\n path = context.get_path(\"#{frontend_skin_preffix}render-view-#{view.model_name}-#{view.render}\")\n view_template_path = path if not path.nil? and File.exist?(path)\n end\n\n return view_template_path \n \n end",
"def derived_name\n return controller_name if respond_to?(:controller_name)\n return model_name.plural if respond_to?(:model_name)\n name ? name.underscore.pluralize : nil\n end",
"def route_name_for_padrino(request)\n request.route_obj.original_path\n rescue\n nil\n end",
"def view_root\n \"views\"\n end",
"def get_view(filename)\n full_file = File.join(options.views, filename)\n if File.exists?(full_file)\n view_file = full_file \n else\n view_directory = File.join(File.dirname(__FILE__),'views')\n view_file = File.join(view_directory,filename)\n end\n open(view_file,'r') { |file| file.read }\n end",
"def get_view(filename)\n full_file = File.join(options.views, filename)\n if File.exists?(full_file)\n view_file = full_file \n else\n view_directory = File.join(File.dirname(__FILE__),'views')\n view_file = File.join(view_directory,filename)\n end\n open(view_file,'r') { |file| file.read }\n end",
"def partial_name\n last = @resources.last\n klass = last.is_a?(Class) ? last : last.class\n klass.model_name.underscore\n end",
"def name\n self.class.name.split('::').last\n end",
"def resource_name\n current_definition.resource_name\n end",
"def route_name\n @route_name || default_route_name\n end",
"def ar_view\n view = nil\n\n if params[:view]\n view = self.class.ar_views[params[:view].to_sym] ||\n self.class.ar_model.interfaces[:rest].views[params[:view].to_sym]\n end\n\n view ||= self.class.ar_views[action_name.to_sym] ||\n self.class.ar_model.interfaces[:rest].views[action_name.to_sym] ||\n View.new(:anonymous)\n view\n end",
"def name_template\n @name_template || self.to_s\n end",
"def inspect\n File.basename @__path\n end",
"def short_name\n @context.name\n end",
"def name\n defined? Rails and Rails.application and Rails.application.class.parent.name\n end",
"def name\n self.class.to_s.split('::').last\n end",
"def readable_context_name\r\n self.name\r\n end",
"def translation_scope\n matcher = /(?<path>.*)\\/_?(?<view>[^\\/.]+)(?<extension>\\.html\\.haml)?/\n info = matcher.match(@virtual_path)\n\n if info\n path = info[:path].gsub('/', '.')\n \"views.#{path}.#{info[:view]}\"\n else\n \"views.#{params[:controller]}.#{params[:action]}\"\n end\n end",
"def name\n self.class.name.split('::').last\n end",
"def find_template(views, name, engine)\n filename = ::File.join(views, \"#{name}.#{engine}\")\n File.exists?(filename) ? filename : nil\n end",
"def route_name; end",
"def route_name; end",
"def file_name(usage)\n if usage.to_s == 'ehtml'\n \"l#{page_layout_root_id}.html.erb\"\n else\n \"l#{page_layout_root_id}.#{usage}\"\n end \n end",
"def name\n @name ||= self.class.non_namespaced_name\n end",
"def view_template\n cell_name + '/#{state}'\n end",
"def name\n self.class.name.split(\"::\").last\n end",
"def name\n self.class.name.split('::').last\n end",
"def name\n return self.class.name.split('::').last\n end",
"def viewable_name\n if to_s().length < 64 && to_s()[0..1] != '#<'\n to_s()\n else\n\t /^\\w*?\\:*(\\w+)$/.match(self.class.name)[1]\n end\n\tend",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/entries/nav.html.erb\"\n else\n \"#{DirMap.html_views}/entries/nav.html.erb\"\n end\n end",
"def path\n Pathname(super)\n end",
"def to_tag_name\n tag_name = if @is_route_engine\n @request.gsub('::', '/').underscore\n else\n @request.split('#').first.singularize\n end\n\n tag_name = tag_name.split('/').last unless use_tag_namespace\n\n tag_name\n end"
] | [
"0.8556762",
"0.8034159",
"0.77579397",
"0.7067324",
"0.6973917",
"0.69542015",
"0.68275934",
"0.67131346",
"0.67075026",
"0.6536749",
"0.65072817",
"0.64933485",
"0.6474512",
"0.64628327",
"0.6385131",
"0.6329606",
"0.6246094",
"0.6246094",
"0.6239353",
"0.6233065",
"0.62258667",
"0.621104",
"0.6208244",
"0.6203263",
"0.61968994",
"0.6177378",
"0.6174481",
"0.6171363",
"0.61705166",
"0.61578363",
"0.6114759",
"0.6097127",
"0.60794014",
"0.6069858",
"0.6036764",
"0.60344243",
"0.6019736",
"0.59921455",
"0.5988697",
"0.5978741",
"0.5961653",
"0.5947715",
"0.5945419",
"0.5941789",
"0.593152",
"0.59212565",
"0.5918701",
"0.5918206",
"0.59079134",
"0.59032935",
"0.5890405",
"0.58838516",
"0.58734345",
"0.58567476",
"0.5849788",
"0.5845588",
"0.58448005",
"0.583961",
"0.5822668",
"0.58172166",
"0.5813822",
"0.5813822",
"0.5813822",
"0.5812719",
"0.5808217",
"0.5803104",
"0.5796756",
"0.5793741",
"0.5784719",
"0.57839996",
"0.5782052",
"0.5767706",
"0.5760592",
"0.5760592",
"0.57581323",
"0.57524997",
"0.5733459",
"0.5731362",
"0.5722417",
"0.57194203",
"0.5719076",
"0.5718009",
"0.5704016",
"0.5702584",
"0.57020587",
"0.57006145",
"0.56990546",
"0.56951314",
"0.569426",
"0.569426",
"0.5693868",
"0.56927985",
"0.5691317",
"0.56863797",
"0.56839716",
"0.5683129",
"0.56807995",
"0.5665751",
"0.5663249",
"0.56599665"
] | 0.79045063 | 2 |
Return String of the code output from the OutputProcessor and stripped of newlines and tabs. | def format_code strip = true
format_ruby self.code, strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n output || content || \"\"\n end",
"def output\n @output.map(&:to_s)\n end",
"def to_s\n @code.to_s\n end",
"def output\n @outputbuffer.string\n end",
"def raw_output(s)\n s\n end",
"def dump_compiled code\n\t\t\tbuf = do_compile code,false\n\t\t\tprint buf,\"\\n\"\n\t\tend",
"def to_s\n lines = @lines.map(&:dup)\n\n if Pry.color\n lines.each do |l|\n l[0] = CodeRay.scan(l[0], @code_type).term\n end\n end\n\n if @with_line_numbers\n max_width = lines.last.last.to_s.length if lines.length > 0\n lines.each do |l|\n padded_line_num = l[1].to_s.rjust(max_width)\n l[0] = \"#{Pry::Helpers::BaseHelpers.colorize_code(padded_line_num.to_s)}: #{l[0]}\"\n end\n end\n\n if @with_marker\n lines.each do |l|\n if l[1] == @marker_line_num\n l[0] = \" => #{l[0]}\"\n else\n l[0] = \" #{l[0]}\"\n end\n end\n end\n\n if @with_indentation\n lines.each do |l|\n l[0] = \"#{' ' * @indentation_num}#{l[0]}\"\n end\n end\n\n lines.map { |l| \"#{l.first}\\n\" }.join\n end",
"def prettify\n @code.gsub(/(.{4})/, '\\1 ').strip\n end",
"def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Scenario Outline:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\" unless steps.empty? || description_text.empty?\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end",
"def output\n return basic_output()\n end",
"def to_s\n code.to_s\n end",
"def to_s\n output || content || \"NO CONTENT\"\n end",
"def inspect\n @code.to_s\n end",
"def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless (description.nil? || description.empty?)\n text << \"\\n\" unless (steps.empty? || description.nil? || description.empty?)\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end",
"def stringOutput\n\t\tend",
"def stringOutput\n\t\tend",
"def raw_output\n @raw_output ||= begin\n lines = path.read.split(\"\\n\")\n lines.shift\n [titre, lines.join(' ').strip_tags(' ')]\n end\n end",
"def output_text\n return strip_ordered_list_tag if ordered_list?\n return strip_unordered_list_tag if unordered_list?\n return @line.sub(InlineExampleRegexp, \"\") if inline_example?\n return strip_raw_text_tag if raw_text?\n return @line\n end",
"def to_s\n @output.inject('') { |r, entry| r << entry.to_s }\n end",
"def to_s\r\n \"Tags=#{@tags.inspect} Code=#{@code.inspect}\"\r\n end",
"def to_s\n text = ''\n\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless steps.empty? || no_description_to_output?\n text << \"\\n#{steps_output_string}\" unless steps.empty?\n\n text\n end",
"def source_code\n next_node_line =\n if next_node\n next_node.line - 1\n else\n @document.source_lines.count + 1\n end\n\n @document.source_lines[@line - 1...next_node_line]\n .join(\"\\n\")\n .gsub(/^\\s*\\z/m, '') # Remove blank lines at the end\n end",
"def output\n @text\n end",
"def assemble\n @code.join\n end",
"def to_s\n \"$ \" + input + \"\\n\" + output\n end",
"def output()\n add_newline if @linebreak\n @text\n end",
"def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless rows.empty? || no_description_to_output?\n text << \"\\n#{parameters_output_string}\" if parameter_row\n text << \"\\n#{rows_output_string}\" unless argument_rows.empty?\n\n text\n end",
"def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Examples:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\" unless description_text.empty?\n text << \"\\n\" + parameters_output_string\n text << \"\\n\" + rows_output_string unless rows.empty?\n\n text\n end",
"def printed_code\n self.code.gsub('/','-')\n end",
"def printed_code\n self.code.gsub('/','-')\n end",
"def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\\n#{background_output_string}\" if background\n text << \"\\n\\n#{tests_output_string}\" unless tests.empty?\n\n text\n end",
"def to_string\n render().join \"\\n\"\n end",
"def output(s)\n if @lstrip\n s = s.gsub(/\\A\\s+/, \"\")\n @lstrip = false\n end\n\n newlines = s.count(NEWLINE)\n if newlines > 0\n @line += newlines\n @offset = s[s.rindex(NEWLINE)..-1].size\n else\n @offset += s.size\n end\n\n @result << s\n end",
"def to_s\n \"#{output}\\n[#{version}]\"\n end",
"def testResult(code)\n require 'sicuro'\n logger.info\"................................#{code}\"\n @codeResult = Sicuro.eval(code)\n logger.info \"............................ #{@codeResult}\"\n (@codeResult.stdout).gsub(/(?:\\n\\r?|\\r\\n?)/, '<br>')\n end",
"def to_s\r\n code \r\n end",
"def strip_trailing_whitespace(code)\n code.gsub(/[ \\t]+$/, '')\n end",
"def to_s\r\n @text_runs.map(&:to_s).join('')\r\n end",
"def to_s\n @out.join\n end",
"def to_s\n render().join \"\\n\"\n end",
"def output\n @out\n end",
"def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Feature:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\\n\" + background_output_string if background\n text << \"\\n\\n\" + tests_output_string unless tests.empty?\n\n text\n end",
"def code_with_trailing_space\n code.chomp+\" \"\n end",
"def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend",
"def output\n temp_string = basic_output()\n if @polygon != nil\n temp_string = temp_string + \"$Polygon\\n\"\n temp_string = temp_string + \"$\\t#{@polygon.utype} = #{@polygon.commandName}\\n\"\n end\n if @zone != nil\n temp_string = temp_string + \"$Zone\\n\"\n temp_string = temp_string + \"$\\t#{@zone.utype} = #{@zone.commandName}\\n\"\n end\n return temp_string\n end",
"def output\n @output\n end",
"def to_s\r\n @code.to_s.upcase\r\n end",
"def to_s\r\n pretty_output\r\n end",
"def to_s\n codeCommentRatio = (sprintf \"%0.2f\", @code.to_f/@comments if @comments > 0) || '--'\n sprintf LINE_FORMAT, @code, @comments, @blank, @lines, codeCommentRatio, @name\n end",
"def code\n @args.map(&:inspect).join(\", \")\n end",
"def output\n return @output || @run_step.output\n end",
"def to_code\n if @sexp\n \"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}\"\n else\n @code\n end\n end",
"def to_s\n return unless filename\n\n result = []\n result << \"%= lang:#{language}#{highlight}\"\n result << '\\begin{code}'\n result.concat(raw_code)\n result << '\\end{code}'\n\n rescue CodeInclusionException => e\n code_error(e.message)\n end",
"def code()\n return @code.clone()\n end",
"def output\n self.class.output\n end",
"def to_s() @out.to_s end",
"def to_s\n @content.chomp\n end",
"def to_s\n @out.join\n end",
"def basic_output()\n temp_string = String.new()\n\n if (@utype != \"\")\n temp_string = temp_string + \"#{@utype} = \"\n end\n temp_string = temp_string + @commandName\n temp_string = temp_string + \"\\n\"\n @keywordPairs.each {|array| temp_string = temp_string + \"\\t#{array[0]} = #{array[1]}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Parents\\n\"\n @parents.each do |array|\n temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\"\n end\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Children\\n\"\n @children.each {|array| temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def compile_to_c\n \"\"\n end",
"def strip_whitespace\n code.gsub!(WHITESPACE_REGEX, ' ')\n\n code\n end",
"def build_examples_output output\n output.join(\"\\n\\n\\t\")\n end",
"def dumpAsString\n\t\tmarkup = \"\"\n\t\[email protected] do |line|\n\t\t\tmarkup += \"#{line}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend",
"def to_s\r\n\t\tSCAsmFile.buffer_as_scasm_file(@contents)\r\n\tend",
"def plain_source\n lines.join\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def plain_source\n lines.join\n end",
"def output\n $stdout\n end",
"def to_s\n Array(render).map(&:to_s).join(\"\\n\")\n end",
"def stdout\n @output.stdout\n end",
"def strip\n result.stdout.strip unless result.stdout.nil?\n end",
"def to_ruby\n res = []\n res.push global_code unless global_code.empty?\n res.push \"control #{id.inspect} do\"\n res.push \" title #{title.inspect}\" unless title.to_s.empty?\n res.push \" desc #{descriptions[:default].inspect}\" unless descriptions[:default].to_s.empty?\n res.push \" impact #{impact}\" unless impact.nil?\n tags.each do |t|\n res.push(\" #{t.to_ruby}\")\n end\n res.push control_code unless control_code.empty?\n res.push 'end'\n res.join(\"\\n\")\n end",
"def trimming_for_diff_text(code)\n # gsub(/^\\s*$/, '') means remove empty lines\n code.strip.gsub(/^\\s*$/, '')\n end",
"def precompiled_method_return_value\n \"_erbout\"\n end",
"def precompiled_method_return_value\n \"_erbout\"\n end",
"def to_s\n [\n self.line_01,\n self.line_02,\n self.line_03,\n ].join(\"\\n\")\n end",
"def preprocess_code(code_string)\n code_string.lines.collect { |line| l = line.strip; l unless l.empty?}.compact\n end",
"def compile_script_string\n @sources.string\n end",
"def show(output = $stout)\n pp(@code,output)\n end",
"def out_clean\n out = $stdout\n $stdout = @stdout\n out.string\n end",
"def to_s\n\t\t# String to return\n\t\tstr = String.new\n\n\t\t# For each line in the current page\n\t\t# Concat it to the String to return\n\t\t@pages[ @ptr ].each do |line|\n\t\t\tstr += line\n\t\tend\n\t\n\t\t# Return result\n\t\tstr\n\n\tend",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def to_s\n result = \"\"\n @tokens.each {|token| result += \"#{token}\\n\"}\n result\n end"
] | [
"0.6610772",
"0.6386455",
"0.6257439",
"0.6250993",
"0.62473464",
"0.6171179",
"0.6165731",
"0.61647725",
"0.6154194",
"0.6153678",
"0.6151913",
"0.60750735",
"0.60585445",
"0.60541433",
"0.60514724",
"0.60514724",
"0.6046068",
"0.6039563",
"0.6033661",
"0.60320026",
"0.60316837",
"0.60236895",
"0.60205543",
"0.5958951",
"0.5942208",
"0.5920667",
"0.5916667",
"0.58977",
"0.5894272",
"0.5894272",
"0.58919317",
"0.5872184",
"0.58698624",
"0.58516467",
"0.5826563",
"0.5816745",
"0.5784585",
"0.57783043",
"0.5774615",
"0.57678944",
"0.57655895",
"0.57587695",
"0.5755807",
"0.5749985",
"0.57425207",
"0.57313",
"0.5722097",
"0.57192653",
"0.57190883",
"0.5716848",
"0.57093126",
"0.5703628",
"0.5684215",
"0.5657005",
"0.56352276",
"0.5624962",
"0.5622408",
"0.5606292",
"0.5594724",
"0.55932623",
"0.55932623",
"0.5590578",
"0.55748475",
"0.55665874",
"0.55594635",
"0.55594087",
"0.5547909",
"0.55456173",
"0.55456173",
"0.5532097",
"0.5529027",
"0.5527855",
"0.5522109",
"0.5518477",
"0.5516016",
"0.55009794",
"0.5492375",
"0.5492375",
"0.5490158",
"0.54821926",
"0.54798853",
"0.54782796",
"0.54767126",
"0.54753786",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54623824",
"0.54618794"
] | 0.5726081 | 46 |
Return String of the user input formatted and stripped of newlines and tabs. | def format_user_input strip = true
format_ruby self.user_input, strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalizeInput(s)\r\n if s == nil\r\n return \"\"\r\n else\r\n return s.gsub(/\\\\n/, \"\\n\")\r\n end\r\n end",
"def clean_input(input)\n input.strip\n end",
"def format_input(input)\n raise \"No content in entry\" if input.nil? || input.strip.length == 0\n input_lines = input.split(/[\\n\\r]+/)\n title = input_lines[0].strip\n note = input_lines.length > 1 ? input_lines[1..-1] : []\n note.map! { |line|\n line.strip\n }.delete_if { |line|\n line =~ /^\\s*$/\n }\n\n [title, note]\n end",
"def user_input(prompt = \"\", newline=false)\r\n prompt += \"\\n\" if newline\r\n Readline.readline(prompt, true).squeeze(\" \").strip\r\nend",
"def sanitize_input(str)\n str.chomp.strip \n # remueve al final del string los \\n,\\t,\\r(chomp) \n #y remueve los espacios en blanco (strip)\n end",
"def format_input(text)\n\t\ttext.downcase.gsub(' ', '').gsub('\\\\', '') \n\tend",
"def get_user_input\n gets.strip\nend",
"def format_text(input)\n input.gsub(/\\r/, \"\\n\")\n end",
"def clean_user_input(input)\n cleansed_input = input.strip.downcase.split.join(\" \")\n cleansed_input\n end",
"def input(prompt=\"\", newline=false)\n prompt += \"\\n\" if newline\n ret = nil\n begin\n ret = Readline.readline(prompt, true).squeeze(\" \").strip\n rescue Exception => e\n return nil\n end\n return ret\nend",
"def gets_input\n\tgets.strip\nend",
"def clean( input )\n input.gsub( %r/\\s+/, '' )\n end",
"def format_input\n\t\t# removing white spaces at the beginning and the end\n\t\t@input_params = @input_params.downcase.strip()\n \tend",
"def format_input(input)\n input\n end",
"def clean_string(input)\r\n unless input.nil?\r\n input = input.to_s.gsub(/^[\\s]+|[\\s]+$/, \"\")\r\n end\r\n return input\r\n end",
"def prompt\n gets.strip\nend",
"def sanitize_input(input)\n\t\tclean_input = input.to_s.scan(/(\"[^\"]+?\"|\\S+)/).flatten.join \" \"\n\n case clean_input[-1]\n when '+'\n [ clean_input[0...-1], :verbose ]\n when '!'\n [ clean_input[0...-1], :full ]\n else\n [ clean_input, :basic ]\n end\n end",
"def whitespace\n @input = @input.gsub(/\\ +/, ' ').strip\n end",
"def strip_breaks(input)\n input.gsub(/\\n/, ' ')\n end",
"def input(prompt)\n raw_input(prompt).strip\n end",
"def get_input\n @input = gets.strip\n end",
"def get_input\n gets.strip #chomp was also used..\nend",
"def normalize_whitespace(input); end",
"def clean t\n # line feed should be removed also\n !t ? '' : t.gsub(\"\\n\",' ').gsub(\"\\t\",' ').strip.gsub(/\\s\\s+/,' ')\nend",
"def admin_strip_text(str)\n\t\tstr.gsub(/\\t|\\n/,'')\n\t\tstr.strip\n\tend",
"def newline_to_space(input)\n input.to_s.gsub(/\\n/, SPACE)\n end",
"def get_title(question)\n\tputs question\n\t@user_input = gets.chomp.tr(' ','+')\nend",
"def input_string prompt=\"Insert: \", maxlen=80\n #ret, str = rb_getstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)\n ret, str = rb_getstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)\n #return str if ret == 0\n #return \"\"\n end",
"def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end",
"def format_input\n str = ARGV[1].gsub(/[^a-zA-Z]+/, '').upcase\n divided = []\n while str.length > 0\n word = str.slice!(0, 5)\n while word.length < 5\n word += \"X\"\n end\n divided << word\n end\n divided.join ' '\nend",
"def get_input(*msg)\n print *msg\n return gets.strip\n end",
"def input msg\n puts msg\n print \" \"\n return STDIN.gets.chomp\nend",
"def tighten\n gsub(/[\\t ]+/,' ').strip\n end",
"def format(input)\n input\n end",
"def to_s_without_spaces\n to_s.gsub(\" \",\"\").gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n end",
"def format_source(source)\n source = source.chomp\n last = source.split(/\\r?\\n/).last\n indent = last ? last[/^([ \\t]*)/, 1].length : 0\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end",
"def standardize_input\n valid_characters = Regexp.new(/\\A[A-Zvx\\^\\&\\!\\~\\|\\-\\>\\<\\(\\)\\ \\[\\]\\{\\}\\,\\+]*\\z/)\n if @user_input =~ valid_characters\n @user_input = @user_input.dup\n @user_input.gsub!(/v/, \"|\")\n @user_input.gsub!(/\\^/, \"&\")\n @user_input.gsub!(/\\~/, \"!\")\n @user_input.gsub!(/\\-\\>/, \">\")\n @user_input.gsub!(/\\<\\-/, \"<\")\n @user_input.gsub!(/\\[\\{/, \"(\")\n @user_input.gsub!(/\\]\\}/, \")\")\n @user_input.gsub!(/\\<\\-\\>/, \"+\")\n @user_input.gsub!(/\\<\\>/, \"+\")\n @user_input\n else\n raise \"Invalid characters in input\"\n end\n end",
"def to_s_without_spaces\n to_s.gsub(\" \",\"\").gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n end",
"def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end",
"def to_s\n \"#{@prompt}#{@text}\"\n end",
"def user_input\n\tgets\nend",
"def summary(input)\n if input.index(/\\n\\n/)\n input.split(/\\n\\n/)[0]\n else\n input\n end\n end",
"def summary(input)\n if input.index(/\\n\\n/)\n input.split(/\\n\\n/)[0]\n else\n input\n end\n end",
"def text_input; end",
"def scrub\n self.gsub(/[^a-zA-Z\\s0-9\\.]/, '').gsub(/\\t/, ' ').gsub(/\\r/, ' ').gsub(/\\s\\s/, '').lstrip.rstrip\n end",
"def prompt(input)\r\n empty_line\r\n input = input.strip\r\n print (input + ': ').colorize(:light_blue)\r\n return gets.chomp\r\n end",
"def captureInput\n return gets.chomp\n end",
"def format_source(source)\n source.chomp!\n indent = source.split(/\\r?\\n/).last[/^([ \\t]*)/, 1].length\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end",
"def input_text\n with_input_io{|io| io.readlines.join}\n end",
"def get_input_until_valid\n buffer = \"\" # Buffer for input lines.\n indent = \"\" # The indent level.\n loop do\n line = gets\n buffer << line\n break if is_valid_syntax?(buffer)\n \n print Kal::Alex::CONFIG::INPUT_PROMPT\n if increases_indent_level?(line)\n indent.concat(\" \" * INDENT_SPACES)\n print indent\n elsif decreases_indent_level?(line)\n indent[-INDENT_SPACES..-1] = \"\"\n print indent\n else\n print indent\n end\n end\n buffer.chomp\n end",
"def determine_username\n\tputs \"What is your name?\"\n\tusername = gets.strip.to_s\nend",
"def get_freeform(question)\n puts \"#{question} (freeform):\"\n gets.strip()\nend",
"def fixInput()\n\t# Debug output\n\tif $DEBUG then STDERR.puts \"in fixInput()\" end\n\n\tremainingChars = 10\n\tmodifiedInput = \"\"\n\n\tARGV.each do |arg| \n\t\tif arg.length > remainingChars then\n\t\t\tmodifiedInput += arg[0...remainingChars]\n\t\t\tbreak\n\t\telse\n\t\t\tmodifiedInput += arg\n\t\t\tremainingChars -= arg.length\n\t\tend\n\tend\n\n\treturn modifiedInput.downcase\nend",
"def text_from_args\n\t\t\treturn ARGV.join(' ').gsub(\"\\t\",'')\n\t\tend",
"def clean_input(text)\n text.gsub(/\\r/, '') rescue text\n end",
"def plainify\n gsub(/[^0-9a-zA-Z_\\- ]/, '').strip.squeeze(' ')\n end",
"def user_content(s)\n nl2br escape_once(s.strip)\n end",
"def space_prompts\n puts \"\"\nend",
"def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end",
"def undent\n indent = split(\"\\n\").select { |line| !line.strip.empty? }.map { |line| line.index(/[^\\s]/) }.compact.min || 0\n gsub(/^[[:blank:]]{#{indent}}/, '').chomp\n end",
"def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end",
"def collectinput\r\n puts \"Please type 3 or 4 words\"\r\n input = gets.strip\r\n system(\"clear\")\r\n return input\r\nend",
"def sanitize content #:nodoc:\n if content.is_a? String\n content.chomp!\n content.gsub!(/\\t/, ' ') # don't display tab\n content.gsub!(/[^[:print:]]/, '') # don't display non print characters\n else\n content\n end\n end",
"def sanitize content #:nodoc:\n if content.is_a? String\n content.chomp!\n content.gsub!(/\\t/, ' ') # don't display tab\n content.gsub!(/[^[:print:]]/, '') # don't display non print characters\n else\n content\n end\n end",
"def simple_format(text)\n text.gsub!(/ +/, \" \")\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.gsub!(/\\n/, \"<br />\\n\")\n text\n end",
"def get_user_input\n user_input_valid gets.chomp\n end",
"def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def use string\n @use = string.gsub(/^\\s*\\n/, '').gsub(/\\n\\s*$/, '')\nend",
"def say_hello\n puts \"What's you're name?\"\n name = gets.strip\n \n#The 'gets' prompts the user, and the 'strip' takes away the line break that comes when you use 'puts'\n \n puts \"Hello #{name}!\" #This is called interpolation \nend",
"def prompt_and_get_input_from_user\n prompt_user\n input = $stdin.readline.strip\nend",
"def outdent( str )\n\t\t\tstr.gsub( /^(\\t|[ ]{1,#{TabWidth}})/, '')\n\t\tend",
"def get_character_from_user\n puts \" Please enter your name: \"\n gets.chomp.to_str\n puts \"\"\n end",
"def paragraphize(input)\n \"#{input.lstrip.rstrip.gsub(/\\n\\n/, '</p><p>').gsub(/\\n/, '')}\"\n end",
"def strip_newlines(input); end",
"def normalize_source(source)\n source.chop.gsub(/\\s*\\n\\s*/, ' ')\n end",
"def display_string_menu(prompt, message)\n puts \"\\n\" * (3 - message.count)\n message.each {|line| puts \" \" * $sp[:l] + line}\n prompt.each {|line| print \"\\n\" + \" \" * $sp[:l] + line}\n input = gets.strip\nend",
"def prompt(instructions)\n \n def decorate(instructions)\n '-' * (instructions.length + 2) \n end\n\n \n # Output instructions with borders \n puts decorate(instructions)\n puts \"|#{instructions}|\\n\"\n puts decorate(instructions) \n \n # flush buffer if not sync\n STDOUT.flush unless STDOUT.sync\n \n \n # getting user input and removing ending returnss and returning the input\n gets.chomp\n \nend",
"def clean_string(input)\n input.downcase.strip\n end",
"def clean(str)\n return nil unless str\n str.gsub(/\\p{Space}/, ' ').strip.squeeze(' ')\n end",
"def input_string; end",
"def normalization_program\n puts normalize(prompt_and_get_input_from_user)\nend",
"def parse_input(input)\n\tinput.split(\" \")\nend",
"def get_user_input(message)\n puts message\n gets.chomp\n end",
"def squash(text)\n return text.scrub.gsub(/[[:space:]]+/, ' ').strip\nend",
"def prompt(question)\n print question\n gets.chop\nend",
"def get_user_input\n gets.chomp\nend",
"def get_user_input\n gets.chomp\nend",
"def evaporate\n self.gsub(/\\s/, '')\n end",
"def get_input(question)\n\t# ask question \n \t# check to make sure something has been entered:\n\n \tanswer = \"\"\n \tputs answer.empty?\n\twhile answer.empty?\n\t\tputs question\n\t\t#get input and remove NewLien character\n\t\tanswer = gets.delete(\"\\n\")\n\tend\n\treturn answer\nend",
"def format_input(input)\n raise EmptyInput, 'No content in entry' if input.nil? || input.strip.empty?\n\n input_lines = input.split(/[\\n\\r]+/).delete_if(&:ignore?)\n title = input_lines[0]&.strip\n raise EmptyInput, 'No content in first line' if title.nil? || title.strip.empty?\n\n date = nil\n iso_rx = /\\d{4}-\\d\\d-\\d\\d \\d\\d:\\d\\d/\n date_rx = /^(?:\\s*- )?(?<date>.*?) \\| (?=\\S)/\n\n raise EmptyInput, 'No content' if title.sub(/^.*?\\| */, '').strip.empty?\n\n title.expand_date_tags(Doing.setting('date_tags'))\n\n if title =~ date_rx\n m = title.match(date_rx)\n d = m['date']\n date = if d =~ iso_rx\n Time.parse(d)\n else\n d.chronify(guess: :begin)\n end\n title.sub!(date_rx, '').strip!\n end\n\n note = Note.new\n note.add(input_lines[1..-1]) if input_lines.length > 1\n # If title line ends in a parenthetical, use that as the note\n if note.empty? && title =~ /\\s+\\(.*?\\)$/\n title.sub!(/\\s+\\((?<note>.*?)\\)$/) do\n m = Regexp.last_match\n note.add(m['note'])\n ''\n end\n end\n\n note.strip_lines!\n note.compress\n\n [date, title, note]\n end",
"def get_input\n gets.chomp\n end",
"def get_input_s\n\tgets.chomp.capitalize\nend",
"def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend",
"def strip(string)\n while string[-1] == \" \" || string[-1] == \"\\n\" || string[-1] == \"\\t\"\n string[-1] = \"\"\n end\n while string[0] == \" \" || string[0] == \"\\n\" || string[0] == \"\\t\"\n string[0] = \"\"\n end\n return string\nend",
"def sanitize_data str\n str.to_s.strip.gsub(%r{^(-\\s)+}, \"\")\n end",
"def format(text)\n text.to_s.downcase.gsub(UNWANTED_CHARACTERS, \"\")\n end",
"def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end",
"def test_doesnt_strips_non_form_inputs\n f = BasicForm.new(:age => \" 3 \\r\\n\", :email => ' [email protected] ')\n assert_equal \" 3 \\r\\n\", f.age\n assert_equal ' [email protected] ', f.email\n end",
"def clean_string s\n s.gsub(/\\s/, \"\")\n end",
"def format(text); end"
] | [
"0.66765386",
"0.66641724",
"0.65570074",
"0.65425307",
"0.6505871",
"0.63928354",
"0.6312676",
"0.6299677",
"0.6281733",
"0.62067086",
"0.61736125",
"0.61420995",
"0.6078183",
"0.60463846",
"0.59712166",
"0.58803535",
"0.5863453",
"0.5840228",
"0.58344245",
"0.57712466",
"0.576798",
"0.5733491",
"0.5714512",
"0.57076573",
"0.5680735",
"0.56767136",
"0.5669841",
"0.5649527",
"0.5637588",
"0.56148535",
"0.56020653",
"0.5595903",
"0.557991",
"0.5575989",
"0.55755764",
"0.5567072",
"0.5549739",
"0.5542654",
"0.5525686",
"0.5521062",
"0.5517514",
"0.551483",
"0.551483",
"0.5513297",
"0.5505429",
"0.5496715",
"0.54910845",
"0.5490411",
"0.5487185",
"0.5485963",
"0.5474235",
"0.54701716",
"0.5456144",
"0.5441814",
"0.54398537",
"0.54317933",
"0.54152006",
"0.5404691",
"0.54032046",
"0.53864527",
"0.5382818",
"0.53726214",
"0.5359068",
"0.5359068",
"0.5357148",
"0.53504074",
"0.5347447",
"0.5331571",
"0.5324552",
"0.532441",
"0.5314297",
"0.5307581",
"0.53022885",
"0.52994746",
"0.5296563",
"0.5292729",
"0.52920455",
"0.52899724",
"0.5289691",
"0.52887255",
"0.52817947",
"0.5281185",
"0.52662927",
"0.5259329",
"0.5254744",
"0.5227366",
"0.5227366",
"0.5226749",
"0.52204895",
"0.52202004",
"0.52189463",
"0.5216309",
"0.52151376",
"0.5212478",
"0.52027434",
"0.520042",
"0.5197916",
"0.5192884",
"0.5188039",
"0.51727587"
] | 0.70295596 | 0 |
Return formatted warning message | def format_message
return @format_message if @format_message
@format_message = self.message.dup
if self.line
@format_message << " near line #{self.line}"
end
if self.code
@format_message << ": #{format_code}"
end
@format_message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_warning_text\n @warnings\n end",
"def warning\n return @warning\n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def bold_warning(*args); end",
"def format_severity diagnostic\n diagnostic.severity == :deprecation ? \"Deprecation notice: \" : \"\"\n end",
"def warning(fmt, *args)\n end",
"def print_warning(msg)\n tag = '[ WARNING ]'\n print_formatted(tag,msg)\n end",
"def warning(string); end",
"def warning(string); end",
"def warning(str, opts = { print: true })\n str = str.dup.to_s\n result = \"\"\n result += color? ? ANSI_CODES[:bold] + ANSI_CODES[:color][:yellow] : \"\"\n result += \"WARNING:\"\n result += color? ? ANSI_CODES[:reset] : \"\"\n result += \" \"\n result += str\n result += \"\\n\"\n print_or_return(result, opts[:print])\n end",
"def warning(text); end",
"def warning(text); end",
"def manifests_warning_message(updated:, not_updated:)\n return \"Unable to construct warning message.\" if updated.empty? || not_updated.empty?\n updated_manifests_names = format_manifests(updated)\n not_updated_manifests_names = format_manifests(not_updated)\n updated_article = updated.size == 1 ? \"The \" : \"\"\n updated_verb = updated.size == 1 ? \"was\" : \"were\"\n not_updated_article = not_updated.size == 1 ? \"the \" : \"\"\n output = \"#{updated_article}#{updated_manifests_names} #{updated_verb} updated, \" \\\n \"but there were no changes in #{not_updated_article}#{not_updated_manifests_names}.\\n\"\\\n \"Did you forget to update #{not_updated_manifests_names}?\"\n return output\n end",
"def warn message\n @options.warn make_message message\n end",
"def format_compile_warning(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def warning(text)\n puts color.colorize(text, :yellow)\n end",
"def warning(msg)\n banner(\"Warning: #{msg}\", YELLOW)\n end",
"def warn(*args); say $terminal.color(format(*args), :magenta); end",
"def warn message\n message = \"WARN: \" + process_message(message)\n output_message message, @warn_color if valid_conditions 2\n end",
"def warn(message)\n err(\"#{color('WARNING:', :yellow, :bold)} #{message}\")\n end",
"def warning(*args); end",
"def message\n msg = \"Format error found in %s tuple: %s\" % [@identifier, @invalid_data.inspect]\n return msg\n end",
"def warning(message)\n log.warn(message.to_s.yellow)\n end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(text)\n STDERR.puts yellow_term_text(text)\n end",
"def warning(*args)\n color(33, *args)\n end",
"def warning(text)\n GitPusshuTen::Log.warning(text)\n end",
"def warning(message)\n write_message message, 'warning'\n end",
"def parse_warn(msg); say :warn, msg; end",
"def to_s\n @warnings.map { |w| \"#{w.rule.code}: #{w.rule.name}: #{w.match[:filename]}:#{w.match[:line]}\" }.sort.uniq.join(\"\\n\")\n end",
"def warnings\n warnings = @fields.collect do |_, field|\n \"for '#{field.field_name}' field: #{field.warning}\" if field.warning\n end.compact.join(\", \").chomp(\", \").split(\", \")\n end",
"def warn message\n super message if @verbosity > 1\n end",
"def warning(msg) log(4, msg); end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def warn(fmt, *args)\n end",
"def warning(warning)\n end",
"def warning_ln(message)\n write_message message, 'warning', true\n end",
"def warn(p0) end",
"def warning(warning_message, *args)\n STDERR.puts(\"#{warning_message} - #{args.join(',')}\")\n end",
"def warning(warning_message, *args)\n STDERR.puts(\"#{warning_message} - #{args.join(',')}\")\n end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def warning\n state(\"warning\")\n end",
"def warning(input)\n puts \"[\\e[35m#{Time.now.strftime('%T')}\\e[0m] \\e[7m#{input}\\e[0m\"\n end",
"def warn\n\n end",
"def warn(message)\n output[:warnings] << message\n end",
"def to_display_without_style\n \"Admin Alert: #{self.message}\".html_safe\n end",
"def bold_warning(*args)\n color('1;33', *args)\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warn_without_prefix( msg = \"\" )\n warn msg\n end",
"def warn(msg)\n stderr \"warning: #{msg}\"\n end",
"def lwarn; end",
"def warn(*args); end",
"def warn(*args); end",
"def create_warnings\n @warnings= \"\"\n @warnings.concat(\"\\n\") if (!@temperature_text.warnings.empty?)\n @warnings.concat(@temperature_text.warnings)\n @warnings.concat(\"\\n\") if (!@wind_text.warnings.empty?)\n @warnings.concat(@wind_text.warnings)\n @warnings.concat(\"\\n\") if (!@rain_text.warnings.empty?)\n @warnings.concat(@rain_text.warnings)\n if (@warnings.empty?)\n @warnings = \"#{I18n.t(\"forecast_text.main.warnings\")}-\"\n else\n @warnings = I18n.t(\"forecast_text.main.warnings\").concat(@warnings)\n end\n nil\n end",
"def warn(message)\n log(\"#{color(\"WARNING:\", :yellow, :bold)} #{message}\")\n end",
"def warn( msg )\n @stringio.puts msg\n end",
"def error_messages(resource_name: , resource: , separator:)\n sanitize_and_translate(\n resource_name: resource_name ,\n resource:resource,\n given_messages: reject_notice_messages(messages: messages)\n ).flatten.join(separator).html_safe\n end",
"def markdown_message warning, message\n if warning.file\n github_url = github_url warning.file, warning.line\n message.gsub!(/(near line \\d+)/, \"[\\\\1](#{github_url})\") if github_url\n end\n if warning.code\n code = warning.format_code\n message.gsub(code, \"`#{code.gsub('`', '``').gsub(/\\A``|``\\z/, '` `')}`\")\n else\n message\n end\n end",
"def warn s,level=0,token=nil,extra=nil\n\t\t\tif level <= $options.warning_level\n\t $stderr.print \"\\nWarn: #{s} in <#{@input_file_name}> \"\n\t\t\t\tif token\n\t \t $stderr.print \"in line #{token.line_no}, pos #{token.char_no}\"\n\t\t\t\t\t# $stderr.print \"by name <#{token.name}>\" if token and token.name\n\t\t\t\t\t$stderr.print \"\\n\"\n\t\t\t\tend\n\t\t\t\tif $options.debug\n \t\t$stderr.print \"Token=\",token.inspect,\"\\n\" if token\n \t\t$stderr.print extra if extra\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def warn(message)\n $stdout.puts(message.red)\nend",
"def warn_with_prefix( msg = \"\" )\n warn \"DEPRECATION WARNING: #{msg}\"\n end",
"def complain something\n puts angry_dude_format something\n end",
"def log_warning warning\n message = '[aws-sdk-gem-warning] ' + warning\n if config.logger\n config.logger.warn(message)\n else\n $stderr.puts(message)\n end\n nil\n end",
"def warning(msg)\n @warnings << msg\n owarn @warnings.last\n end",
"def warning(type, message, lineno)\n end",
"def format_message level, time, msg\n prefix = case level\n when \"warn\"; \"WARNING: \"\n when \"error\"; \"ERROR: \"\n else \"\"\n end\n \"[#{time.to_s}] #{prefix}#{msg.rstrip}\\n\"\n end",
"def alert_warning(statement, question = nil)\n ui.alert_warning statement, question\n end",
"def output_specific_warnings\n specific_warnings = self.get_specific_warnings || []\n unless specific_warnings.empty?\n specific_warnings.each do |warning| \n puts warning \n # hash.each do |file_name, arr|\n # puts arr.join(', ') # + ' (' + file_name + ') '\n # end\n end\n else\n puts 'No warnings related to variables.'\n end\n end",
"def member_warnings\n competition_registrants = competition.signed_up_registrants\n error = \"\"\n if status != \"active\"\n error += \"Competitor is #{status}\"\n if status == \"withdrawn\"\n if withdrawn_at.present?\n error += \" as of #{withdrawn_at.to_fs(:short)}\"\n end\n end\n error += \"<br>\"\n end\n\n members.each do |member|\n if member.currently_dropped?\n error += \"Registrant #{member} has dropped this event from their registration<br>\"\n elsif !competition_registrants.include?(member.registrant)\n error += \"Registrant #{member} is not in the default list for this competition<br>\"\n end\n end\n error.html_safe # rubocop:disable Rails/OutputSafety\n end",
"def puts_warning(msg)\n $stdout.puts \"\\e[33m[WARNING] #{msg}\\e[0m\" if Calamum::Config[:debug]\nend",
"def warning?\n severity == :WARNING\n end",
"def warning!\n self.severity = :WARNING\n end",
"def describe_error\n message = \"\"\n if self.account_number == nil\n message = message + I18n.t(:wrong_or_missing_account_number, :scope => [:model, :index]) + \" \"\n end\n if self.account_bank_number == nil\n message = message + I18n.t(:wrong_or_missing_account_bank_number, :scope => [:model, :index]) + \" \"\n end\n if self.student.uic == nil\n message = message + I18n.t(:missing_uic, :scope => [:model, :index]) + \" \"\n end\n if self.sident == -666\n message = message + I18n.t(:missing_sident_666, :scope => [:model, :index]) + \" \"\n end\n if self.sident == nil\n message = message + I18n.t(:missing_sident, :scope => [:model, :index]) + \" \"\n end\n return message\n\n end",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def GetLastWarning\n @warning\n end",
"def warnings\n @diagnostics.select {|d| d.severity == :warning || d.severity == :deprecation }\n end",
"def unified_message\n notice.message.gsub(/(#<.+?):[0-9a-f]x[0-9a-f]+(>)/, '\\1\\2')\n end",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def warning(str)\n @parts.push(warning: str)\n end",
"def err(message)\n warn \" > #{message}\"\nend",
"def warn(part, msg)\n self.project.shell.say \"\\033[37m#{part.class.to_s}\\033[0m\" + \" : \" + \"\\033[31m#{msg.to_s}\\033[0m\", nil, true\n end",
"def warn?; @level <= WARN; end",
"def warn?; @level <= WARN; end",
"def warn(part, msg)\n self.project.shell.say \"\\033[37m#{part.class.to_s}\\033[0m\" + \" : \" + \"\\033[31m#{msg.to_s}\\033[0m\", nil, true\n end",
"def stru(msg); \"202 Only accepts file\"; end",
"def warning(message)\n @warnings = [] unless @warnings.present?\n @warnings.append(message)\n end"
] | [
"0.77053744",
"0.74953747",
"0.7404663",
"0.7404663",
"0.7391339",
"0.7364305",
"0.7326834",
"0.7296612",
"0.7285692",
"0.7285692",
"0.72714883",
"0.7265686",
"0.7265686",
"0.72126067",
"0.72025603",
"0.71862197",
"0.70827925",
"0.7061496",
"0.6943915",
"0.69236934",
"0.6923506",
"0.6922893",
"0.68751127",
"0.6874092",
"0.68732935",
"0.68732935",
"0.68732935",
"0.687115",
"0.6870998",
"0.68503004",
"0.6836695",
"0.6834901",
"0.68151873",
"0.6811419",
"0.6807225",
"0.6768264",
"0.6755408",
"0.67319125",
"0.6720841",
"0.67202646",
"0.67037857",
"0.66951144",
"0.66951144",
"0.6671521",
"0.6660645",
"0.6635205",
"0.66192067",
"0.6608581",
"0.65802544",
"0.65378606",
"0.6536815",
"0.6536815",
"0.6536815",
"0.6520146",
"0.64917016",
"0.64917016",
"0.64917016",
"0.64917016",
"0.64917016",
"0.64917016",
"0.64917016",
"0.64917016",
"0.64871544",
"0.6473321",
"0.64623445",
"0.6460829",
"0.6460829",
"0.6451392",
"0.64280856",
"0.64166415",
"0.6411754",
"0.64029795",
"0.6384756",
"0.63654816",
"0.6359594",
"0.63272864",
"0.632687",
"0.6320291",
"0.6320041",
"0.631775",
"0.631658",
"0.6304518",
"0.6297015",
"0.6293947",
"0.6291162",
"0.6274449",
"0.6273661",
"0.6251876",
"0.62474346",
"0.624053",
"0.62324685",
"0.6218225",
"0.61980766",
"0.61893356",
"0.6181768",
"0.617034",
"0.61644995",
"0.61644995",
"0.61638725",
"0.6162763",
"0.6155642"
] | 0.0 | -1 |
Generates a hash suitable for inserting into a table | def to_row type = :warning
@row = { "Confidence" => self.confidence,
"Warning Type" => self.warning_type.to_s,
"Message" => self.format_message }
case type
when :template
@row["Template"] = self.view_name.to_s
when :model
@row["Model"] = self.model.to_s
when :controller
@row["Controller"] = self.controller.to_s
when :warning
@row["Class"] = self.class.to_s
@row["Method"] = self.method.to_s
end
@row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def generate_row_key link\n # rowkey is 'md5_hashed_link'\n d = Digest::MD5.new\n d.hexdigest link\nend",
"def hash(*) end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def to_hash() end",
"def build_hash_code\n\t\tSecureRandom.hex(8) + (Time.now.to_f * 1000).to_i.to_s\n\tend",
"def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def merchanthash\n if version.to_i == 1 \n return HashGenerator::generate(merchant_hash_key, merchant_id, order_id);\n else\n return Digest::SHA512.hexdigest(\"#{merchant_hash_key},#{merchant_id},01,#{order_id},#{gross_amount}\")\n end\n end",
"def hash_code; end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hexhash\n hash.to_s(16)\n end",
"def hash(key); end",
"def hash\n @table.hash\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end",
"def generate_hash_code\n\t\tself.hash_code = rand(999999)\n\tend",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n\n end",
"def hornerHash( key, tableSize)\n\tsize = key.length\n\th = 0\n\ti = 0\n\twhile (i < size)\n\t\th = (32 * h + key[i].ord) % tableSize\n\t\ti += 1\n\tend\n\treturn h\nend",
"def hash\n 0\n end",
"def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def hash_generator(pass)\n require 'openssl'\n\n # Get hash parameters\n params = hash_decoder\n\n algo = params['algo']\n salt = params['salt']\n\n iter = if params['iter']\n params['iter'].to_i\n else\n 1\n end\n\n new_hash = (salt + pass).each_byte.to_a\n digest = OpenSSL::Digest.new(algo.delete('-'))\n\n 1.upto(iter) do\n digest.reset\n digest << new_hash.pack('c*')\n new_hash = digest.to_s.scan(/../).map(&:hex)\n end\n\n digest.to_s\n end",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end",
"def hash=(_arg0); end",
"def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end",
"def generate_hash(id, raffle_number)\n Digest::SHA256.base64digest(id+ raffle_number)\nend",
"def hash99999\n return nil unless @parts\n\n k = construct\n return nil unless k\n\n Digest::SHA256.hexdigest(construct[0..-6] << '99999')[0..23]\n end",
"def hash\n guid.hash\n end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def hash\n \tcustom_unique_id.hash\n end",
"def get_hash(machines)\n branch = get_branch_id\n hash = Digest::SHA1.hexdigest(machines.sort.join)\n \"#{branch}__#{hash}\"\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def generate_hash_token\n\t\t\tbegin\n\t\t\t\tself.hash_token = (0...5).map { (65 + rand(26)).chr }.join\n\t\t\tend while self.class.exists?(hash_token: hash_token)\n\t\tend",
"def hash_encode(i)\n @hasher.encode i\n end",
"def create_invite_hash!\n self.invite_hash = Digest::SHA2.new(256).update(\"#{self.serializable_hash}+#{Time.now}+jibffffrrrji!@#sh\").to_s[2..12]\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def unique_hash\n\t\tif self.unique_token.blank?\n\t\t\tupdate_attribute(:unique_token, Devise.friendly_token[0,50].to_s)\n\t\tend\n\t\tDigest::SHA2.hexdigest(self.unique_token + id.to_s)\n\tend",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def hash()\n #This is a stub, used for indexing\nend",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def generate_hashkey_for(params, api_key)\n sorted_params = sort_params(params)\n params_string = concat_params(sorted_params)\n Digest::SHA1.hexdigest \"#{params_string}&#{api_key}\"\n end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def hash #:nodoc:\n uuid.hash\n end",
"def generate_hash_string#:doc:\n return true unless self.hash_string.nil?\n begin\n self.hash_string = Digest::MD5.hexdigest(Time.now.to_f.to_s)\n end while self.class.find_by_hash_string(self.hash_string)\n end",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def create_tps_hash(data, hash_type)\n return \"SECRET KEY NOT PROVIDED\" if !defined? @SECRET_KEY\n case hash_type \n when 'HMAC_SHA256'\n OpenSSL::HMAC.hexdigest('sha256', @SECRET_KEY, data)\n when 'SHA512'\n Digest::SHA512.hexdigest(@SECRET_KEY + data)\n when 'SHA256'\n Digest::SHA256.hexdigest(@SECRET_KEY + data)\n when 'MD5'\n Digest::MD5.hexdigest(@SECRET_KEY + data)\n else\n OpenSSL::HMAC.hexdigest('sha512', @SECRET_KEY, data)\n end\n end",
"def hashing(i)\n \n return ALPHABET[0] if i == 0\n hash = ''\n base = ALPHABET.length\n while i > 0\n hash<< ALPHABET[i.modulo(base)]\n i /= base\n end\n hash.reverse\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def Hash_Func( str )\n hash = 0\n i = 0\n while i < str.length\n c = str[i]\n hash = hash * 31 + c.ord\n i = i + 1\n end\n hash = hash.abs\n return PaddGUID( hash )\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash_transactions\n tx_ids = transactions.map do |tx|\n tx.id\n end\n Digest::SHA256.hexdigest(tx_ids.join(''))\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash_byte_size\n return 20\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def generate_key; end",
"def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end",
"def table_digest(table)\n digest = Digest::MD5.new\n table.flatten.each do |cell|\n digest.update(unescape(cell))\n end\n return digest.to_s\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def hashed_input\n\t\tmd5_hex = Digest::MD5.hexdigest(@term)\n\t\tmd5_hex.scan(/../).map { |s| s.to_i(16) }\n\tend",
"def hash\n model.hash + key.hash\n end",
"def ensure_hash_id\n self.hash_id ||= unique_random_string_of_length(75 + Random.rand(26))\n end",
"def to_hash\n @__table\n end",
"def hash\n swap\n scatter\n completed_string\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend"
] | [
"0.7232455",
"0.7232455",
"0.7232455",
"0.7232455",
"0.7232455",
"0.7232455",
"0.7232455",
"0.672066",
"0.66973644",
"0.6657042",
"0.66339666",
"0.65941423",
"0.65863746",
"0.651638",
"0.6490185",
"0.6483761",
"0.64712316",
"0.6425764",
"0.6409383",
"0.6315767",
"0.6313063",
"0.63043785",
"0.6292932",
"0.6275149",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62597483",
"0.62385046",
"0.62373245",
"0.62211174",
"0.62197113",
"0.621073",
"0.6210242",
"0.6198465",
"0.6175762",
"0.617246",
"0.6167398",
"0.6152409",
"0.61515206",
"0.6145509",
"0.6144646",
"0.611931",
"0.61028796",
"0.6092581",
"0.60754925",
"0.6059377",
"0.6058372",
"0.6054559",
"0.60545516",
"0.6049737",
"0.60326874",
"0.60326874",
"0.6029365",
"0.6028119",
"0.6025725",
"0.60190946",
"0.6006528",
"0.6005699",
"0.5986843",
"0.5986843",
"0.5986843",
"0.59613365",
"0.59579337",
"0.5950783",
"0.5950645",
"0.5941978",
"0.5941078",
"0.59384453",
"0.593716",
"0.5924854",
"0.5917718",
"0.5898865",
"0.5897343",
"0.589677",
"0.58955824",
"0.5891014",
"0.5886083",
"0.5875419",
"0.5875419",
"0.5875419",
"0.58730745",
"0.5867886",
"0.5866022",
"0.58634305",
"0.58522725",
"0.58506817",
"0.5844707",
"0.5843845",
"0.58397776",
"0.5836804",
"0.58333373",
"0.58332825",
"0.58332825",
"0.58218116"
] | 0.0 | -1 |
Functions to determine install status and version for IHS | def ihs_installed?
get_version = node['ihs']['install_dir'] + '/bin/versionInfo.sh'
begin
!/^IHS\s+installed$/.match(shell_out(get_version).stdout).to_s.empty?
rescue Errno::ENOENT => e
Chef::Log.info "File not found: #{get_version}, error: #{e}"
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_info\n if defined?(Sensu::Enterprise::VERSION)\n [\"enterprise\", Sensu::Enterprise::VERSION]\n else\n [\"core\", Sensu::VERSION]\n end\n end",
"def software_status(opts)\n opts = check_params(opts,[:installation_ids])\n super(opts)\n end",
"def installed_versions; end",
"def get_install_status\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def installed_version\n logger.trace(\"#{new_resource} checking package version\")\n current_installed_version\n end",
"def installed_version\n capture(\"#{chef_solo} -v || true\") =~ /Chef: (\\d+\\.\\d+\\.\\d+)/ ? $1 : nil\n end",
"def installed_version\n lines = powershell_out!('Get-WmiObject -Class win32_product')\n .stdout.lines\n idx = lines.index do |l|\n l.match(/^\\W*Name\\W+:\\W+Chef Development Kit/)\n end\n return false if idx.nil?\n ver = lines[idx + 2].match(/:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def ic_version_if_changed\n return nil if do_not_check_for_version_change\n if step_not_modified\n begin\n # ae = application_environment\n ae = []\n request.apps.each do |app|\n ae << app.application_environments.find_by_environment_id(request.environment_id)\n end\n # ac = application_component\n ac = []\n ae.each do |app_env|\n ac << app_env.application_components.find_by_component_id(component_id)\n end\n ae.flatten!\n ac.flatten!\n # ic = installed_component\n ic = InstalledComponent.find_by_application_component_id_and_application_environment_id(ac.map(&:id), ae.map(&:id))\n ic.nil? ? nil : (ic.version.eql?(version_name) ? nil : ic.version)\n rescue\n nil\n end\n end\n end",
"def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end",
"def installed\n api.get('installed')\n end",
"def installed_version\n sh = shell_out('pkgutil --pkg-info com.getchef.pkg.chefdk')\n return false if sh.exitstatus.nonzero?\n ver = sh.stdout.match(/^version:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)$/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def status\n version.status\n end",
"def status\n version.status\n end",
"def what_is_installed?\n which_os = os.green\n package_manager = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n exe_installed = ( pianobar? ? 'Yes'.green : 'No'.red.blink )\n ctl_file = ( ctl? ? 'Yes'.green : 'No'.red.blink )\n has_notifier = ( notify? ? 'Yes'.green : 'No'.red.blink )\n ok = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n\n puts get_template 'what_is_installed', binding\n\n has_installer?\n end",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end",
"def installed_version\n raise NotImplementedError\n end",
"def check_installed\n @install_array = []\n cmd = \"\\\"#{webpicmd}\\\" /List /ListOption:Installed\"\n cmd << \" /XML:#{node['webpi']['xmlpath']}\" if node['webpi']['xmlpath']\n cmd_out = shell_out(cmd, returns: @new_resource.returns)\n if cmd_out.stderr.empty?\n @new_resource.product_id.split(',').each do |p|\n # Example output\n # HTTPErrors IIS: HTTP Errors\n # Example output returned via grep\n # \\r \\rHTTPErrors IIS: HTTP Errors\\r\\ns\n if cmd_out.stdout.lines.grep(/^\\s{6}#{p}\\s.*$/i).empty?\n @install_array << p\n end\n end\n else\n Chef::Log.info(cmd_out.stderr)\n @install_array = @new_resource.product_id\n end\n @install_list = @install_array.join(',')\n end",
"def get_rpm_status(proj_info)\n if proj_info.type == :module\n # FIXME This ASSUMES the release qualifier is 0 instead of using\n # simp-core/build/rpm/dependencies.yaml.\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-0.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n else\n # FIXME If the RPM release qualifier has a %dist macro in it, there\n # is no way to accurately extract it from the spec file. The logic\n # below is a hack!\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-#{proj_info.release}.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el6.gsub!('el7','el6')\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n url_el7.gsub!('el6','el7')\n end\n\n # query PackageCloud to see if a release to both el6 and el7 repos has been made\n # Note that each URL is for a page with a download button, not the RPM itself.\n debug(\"Checking existence of #{url_el6}: #{url_exists?(url_el6) ? 'exists' : 'does not exist'}\")\n debug(\"Checking existence of #{url_el7}: #{url_exists?(url_el7) ? 'exists' : 'does not exist'}\")\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_released = rpms_found ? :released : :unreleased\n rpms_released\n end",
"def get_rpm_status(proj_info)\n if proj_info.type == :module\n # FIXME This ASSUMES the release qualifier is 0 instead of using\n # simp-core/build/rpm/dependencies.yaml.\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-0.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n else\n # FIXME If the RPM release qualifier has a %dist macro in it, there\n # is no way to accurately extract it from the spec file. The logic\n # below is a hack!\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-#{proj_info.release}.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el6.gsub!('el7','el6')\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n url_el7.gsub!('el6','el7')\n end\n\n # query PackageCloud to see if a release to both el6 and el7 repos has been made\n # Note that each URL is for a page with a download button, not the RPM itself.\n debug(\"Checking existence of #{url_el6}: #{url_exists?(url_el6) ? 'exists' : 'does not exist'}\")\n debug(\"Checking existence of #{url_el7}: #{url_exists?(url_el7) ? 'exists' : 'does not exist'}\")\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_released = rpms_found ? :released : :unreleased\n rpms_released\n end",
"def wp_install_version_check(site=@site, verbose=true)\n @wp_paths.each do |p|\n installer = site.sub(/\\/$/, '') + p + '/INSTALL.html'\n res = @http.get(installer)\n if res[0] =~ /for (WordPress \\d+.\\d+?.?\\d+)<\\/title>/i\n wp_version = $1.chomp\n print_good(\"#{p}/INSTALL.html Found!\") if verbose\n print_line(\" Version: #{wp_version}\") if verbose\n return wp_version\n elsif res[0] =~ /<br \\/> Version (.*)/\n wp_version = $1.chomp\n print_good(\"#{p}/INSTALL.html Found!\") if verbose\n print_line(\" Version: #{wp_version}\") if verbose\n return wp_version\n end\n end\n print_error(\"/INSTALL.html Not Found!\") if verbose\n return nil\n end",
"def get_version(apps)\n apps.each do |app|\n if File.exists?(\"#{app}/Contents/Info.plist\")\n short = app.sub(/\\/Applications\\//, '')\n vers = `/usr/bin/defaults read \"#{app}\"/Contents/Info CFBundleShortVersionString`.chomp\n res = puts \"#{short}: #{vers}\"\n $?.success? ? res : \"ERROR: could not get version\"\n else\n puts \"#{app} is not installed.\"\n end\n end\nend",
"def installed_versions(name, requirement)\n if gem_installed?(name, requirement)\n Chef::Log.info \"Gem #{name} (#{requirement}) found in OpsWorks user space.\"\n # from rubygems/specification.rb#find_all_by_name\n Gem::Dependency.new(name, requirement).matching_specs\n else\n Chef::Log.debug \"Gem #{name} (#{requirement}) not found in OpsWorks user space.\"\n []\n end\n end",
"def api_info(req)\n client.request(req) do |response|\n json_response = ::RHC::Json.decode(response.content)\n [ json_response['supported_api_versions'], json_response['api_version'] || json_response['version'].to_f, json_response['data'] ]\n end\n end",
"def get_ai_repo_version(options)\n options = get_ai_publisherurl(options)\n if options['test'] == true || options['host-os-name'].to_s.match(/Darwin/)\n version = \"0.175.1\"\n else\n message = \"Information:\\tDetermining if available repository version from \"+options['publisherurl']\n command = \"pkg info -g #{options['publisherurl']} entire |grep Branch |awk \\\"{print \\\\\\$2}\\\"\"\n version = execute_command(options,message,command)\n version = version.chomp\n version = version.split(/\\./)[0..2].join(\".\")\n end\n return version\nend",
"def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end",
"def install_summary\n return @install_summary\n end",
"def platform_version\n Ohai.platform_version\n end",
"def Check_OS_Version()\n\tos_version = `ver`\n\treturn os_version\nend",
"def get_depot_version(ssh_session,filename,depot_url,os_version)\n if !filename.match(/[A-z]/)\n (ssh_session,output) = ssh_session_exec(ssh_session,\"esxcli network firewall ruleset set -e true -r httpClient\")\n (ssh_session,depot_version) = ssh_session_exec(ssh_session,\"esxcli software sources vib list -d #{depot_url} 2>&1 | grep '#{os_version}' |grep 'esx-base' |grep Update |awk '{print $2}' |tail -1\")\n if !depot_version\n (ssh_sessionm,depot_version) = ssh_session_exec(ssh_session,\"esxcli software sources vib list -d #{depot_url} 2>&1 | grep '#{os_version}' |grep 'esx-base' |grep Installed |awk '{print $2}' |tail -1\")\n end\n depot_version = depot_version.chomp \n else\n tmp_dir = \"/tmp/esxzip\"\n if !File.directory?(tmp_dir)\n Dir.mkdir(tmp_dir)\n end\n %x[unzip -o #{filename} metadata.zip -d #{tmp_dir}]\n depot_version = %x[unzip -l #{tmp_dir}/metadata.zip |awk '{print $4}' |grep '^profiles' |grep standard].chomp\n depot_version = depot_version.split(/\\//)[1].split(\"-\")[0..-2].join(\"-\")\n end\n if $verbose_mode == true\n puts \"Depot release: \"+depot_version\n end\n return ssh_session,depot_version\nend",
"def has_version?; end",
"def get_os_version(ssh_session)\n (ssh_session,os_version) = ssh_session_exec(ssh_session,\"uname -r\")\n os_version = os_version.chomp\n if $verbose_mode == true\n puts \"vSphere version: \"+os_version\n end\n return ssh_session,os_version\nend",
"def check_ai_pkg_repo(options,p_struct,pkg_name,pkg_repo_dir)\n pkg_version=p_struct[pkg_name].version\n message = \"Information:\\tChecking if repository contains \"+pkg_name+\" \"+pkg_version\n command = \"pkg info -g #{pkg_repo_dir} -r #{pkg_name} |grep Version |awk \\\"{print \\\\\\$2}\\\"\"\n output = execute_command(options,message,command)\n repo_pkg_version = output.chomp\n return repo_pkg_version\nend",
"def get_nifi_version\n version = send_request_cgi({\n 'uri' => normalize_uri(datastore[\"Nifi-Path\"], '/flow/about')}).get_json_document['about']['version']\n end",
"def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end",
"def install_date\n in_service_date\n end",
"def processing_state\n return 'pending' if installments.empty?\n\n installments.last.fulfilled? ? 'success' : 'failed'\n end",
"def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end",
"def get_version\n\t\tend",
"def get_os\n system=`/usr/bin/sw_vers -productVersion`.chomp.split(\".\").slice(1).to_i\n if system==4 then\n return \"tiger\"\n else\n return \"leo\"\n end\nend",
"def installation\n mode == \"installation\" || mode == \"autoinstallation\" ||\n mode == \"live_installation\"\n end",
"def get_version()\n\t\tend",
"def installed?\n !installed_version.nil?\n end",
"def get_loc_ver(app_name)\n loc_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_loc_ver(app_name)\")\n if loc_ver.to_s.match(/Installed/)\n loc_ver = \"Not Installed\"\n end\n return loc_ver\nend",
"def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\n end",
"def verify_im_installed?(installed_directory)\n step \"Verify IBM Installation Manager is installed into directory: #{installed_directory}\"\n step 'Verify 1/3: IBM Installation Manager Launcher'\n fail_test \"Launcher has not been found in: #{installed_directory}/eclipse\" if agent.file_exist?(\"#{installed_directory}/eclipse/launcher\") == false\n\n step 'Verify 2/3: IBM Installation Manager License File'\n fail_test \"License file has not been found in: #{installed_directory}/license\" if agent.file_exist?(\"#{installed_directory}/license/es/license.txt\") == false\n\n step 'Verify 3/3: IBM Installation Manager Version'\n fail_test \"Version has not been found in: #{installed_directory}/properties/version\" if agent.file_exist?(\"#{installed_directory}/properties/version/IBM_Installation_Manager.*\") == false\nend",
"def check_version\n var_error = nil\n status = 'ok'\n begin\n Provider.first\n rescue => error\n var_error = error\n status = 'fail'\n end\n version_message ='%s version %s is up and running at %s:%s.' % [\n 'Onestop Provisioning App', SERVER_CONFIGURATION[\"onestop_code_version\"], request.host, request.port ]\n if var_error.nil?\n db_status = \"Onestop Provisioning is connected to database on account ID #{ActiveRecord::Base.connection_config[:username]}\"\n else\n db_status = \"Onestop Provisioning is currently experiencing problems with connecting to database. Error: #{var_error}\"\n end\n render json: { version_message: version_message + db_status, status: status, api_version: SERVER_CONFIGURATION[\"onestop_code_version\"], server_instance_name: ServerConfiguration::CONFIG['onestop_server_instance_name'] }\n end",
"def ihs_plg_installed?\n get_version = node['ihs']['plugin']['install_dir'] + '/bin/versionInfo.sh'\n\n begin\n !/^PLG\\s+installed$/.match(shell_out(get_version).stdout).to_s.empty?\n rescue Errno::ENOENT => e\n Chef::Log.info \"File not found: #{get_version}, error: #{e}\"\n return false\n end\n end",
"def all_software_status\n super\n end",
"def detect_installed_version\n return @installed_version unless self.class.method_defined?(:installed_version_file)\n\n version_match = find_first_match(:matching => installed_version_regexp, :in_file => installed_version_file)\n\n # if multiple parts are matched, join them back\n version = version_match.captures.reject(&:nil?).join(\".\")\n\n # convert commas into dots so Versionomy can parse them too\n version = version.gsub(',', '.')\n\n if version\n @installed_version_text = version.strip\n @installed_version = Versionomy.parse(@installed_version_text).change({}, :optional_fields => [:tiny])\n end\n end",
"def app_version_message_and_status(user_version=\"\", device_type)\n hsh = HashWithIndifferentAccess.new\n hsh[:status] = 0; hsh[:message] = \"\"; hsh[:store_link] = \"\" #default for every user(if no condition is matched)\n if device_type == \"IOS\" && user_version.present? #For ios devices with app versions\n hsh = app_version_message_and_status_for_ios(user_version,hsh)\n elsif device_type == \"ANDROID\" && user_version.present? #For android devices with app versions\n hsh = app_version_message_and_status_for_android(user_version,hsh)\n end\n return hsh\n end",
"def current_version?\n version == FirmwareUpgrade.current_software_version\n end",
"def check_version\n temp_file = \"/tmp/awsssh_version_check\"\n if File.exists?(temp_file)\n if ((Time.now - File.mtime(temp_file)) / (60 * 60 * 2)).to_i != 0 # check all 2h\n check = true\n else\n check = false\n end\n else\n check = true\n end\n if check\n begin\n rubygems = JSON.parse(open(\"https://rubygems.org/api/v1/versions/awsssh/latest.json\").read)\n if rubygems[\"version\"] != VERSION\n puts \" ############################################\".colorize(:red)\n puts \" # You're using an old version of this gem! #\".colorize(:red)\n puts \" # Run `gem update awsssh` #\".colorize(:red)\n puts \" ############################################\".colorize(:red)\n puts\n end\n rescue\n ensure\n FileUtils.touch(temp_file)\n end\n end\n end",
"def installation?; @installation; end",
"def version_info\n (Wrapper.msc_who_am_i @msc_ptr).to_s\n end",
"def required_version\n fetch(:chef_version) || nil\n end",
"def software_installed?(name)\n result = execute_with_result('type', name)\n result and /\\A(#{name})(.)+(#{name})$/.match(result).to_a.count >= 3\n end",
"def confirmInstallation\n heading = \"\"\n body = \"\"\n confirm_button_label = \"\"\n\n if !Mode.update\n # Heading for confirmation popup before the installation really starts\n heading = HTML.Heading(_(\"Confirm Installation\"))\n\n # Text for confirmation popup before the installation really starts 1/3\n body = _(\n \"<p>Information required for the base installation is now complete.</p>\"\n )\n\n some_destructive = Builtins.find(Storage.GetCommitInfos) do |info|\n Ops.get_boolean(info, :destructive, false)\n end != nil\n\n if some_destructive\n # Text for confirmation popup before the installation really starts 2/3\n body = Ops.add(\n body,\n _(\n \"<p>If you continue now, <b>existing\\n\" +\n \"partitions</b> on your hard disk will be <b>deleted</b> or <b>formatted</b>\\n\" +\n \"(<b>erasing any existing data</b> in those partitions) according to the\\n\" +\n \"installation settings in the previous dialogs.</p>\"\n )\n )\n else\n # Text for confirmation popup before the installation really starts 2/3\n body = Ops.add(\n body,\n _(\n \"<p>If you continue now, partitions on your\\n\" +\n \"hard disk will be modified according to the installation settings in the\\n\" +\n \"previous dialogs.</p>\"\n )\n )\n end\n\n # Text for confirmation popup before the installation really starts 3/3\n body = Ops.add(\n body,\n _(\"<p>Go back and check the settings if you are unsure.</p>\")\n )\n\n confirm_button_label = Label.InstallButton\n else\n # Heading for confirmation popup before the update really starts\n heading = \"<h3>\" + _(\"Confirm Update\") + \"</h3>\"\n\n body =\n # Text for confirmation popup before the update really starts 1/3\n _(\"<p>Information required to perform an update is now complete.</p>\") +\n # Text for confirmation popup before the update really starts 2/3\n _(\n \"\\n\" +\n \"<p>If you continue now, data on your hard disk will be overwritten\\n\" +\n \"according to the settings in the previous dialogs.</p>\"\n ) +\n # Text for confirmation popup before the update really starts 3/3\n _(\"<p>Go back and check the settings if you are unsure.</p>\") \n\n\n # Label for the button that confirms startint the installation\n confirm_button_label = _(\"Start &Update\")\n end\n\n heading_bg_color = \"#A9CEDD\"\n\n display_info = UI.GetDisplayInfo\n text = Ops.get_boolean(display_info, \"RichTextSupportsTable\", false) ?\n Builtins.sformat(\n \"<table bgcolor=\\\"%1\\\"><tr><td>%2</td></tr></table>%3\",\n heading_bg_color,\n heading,\n body\n ) :\n Ops.add(heading, body)\n\n size_x = Builtins.tointeger(Ops.get_integer(display_info, \"Width\", 800))\n size_y = Builtins.tointeger(Ops.get_integer(display_info, \"Height\", 600))\n\n # 576x384 support for for ps3\n # bugzilla #273147\n if Ops.greater_or_equal(size_x, 800) && Ops.greater_or_equal(size_y, 600)\n size_x = 70\n size_y = 18\n else\n size_x = 54\n size_y = 15\n end\n\n UI.OpenDialog(\n VBox(\n VSpacing(0.4),\n HSpacing(size_x), # force width\n HBox(\n HSpacing(0.7),\n VSpacing(size_y), # force height\n RichText(text),\n HSpacing(0.7)\n ),\n ButtonBox(\n PushButton(\n Id(:cancel),\n Opt(:cancelButton, :key_F10, :default),\n Label.BackButton\n ),\n PushButton(Id(:ok), Opt(:okButton, :key_F9), confirm_button_label)\n )\n )\n )\n\n button = Convert.to_symbol(UI.UserInput)\n UI.CloseDialog\n\n button == :ok\n end",
"def get_build\n if defined?(@major) and defined?(@minor) and defined?(@build) then\n return @major, @minor, @build\n else\n @major, @minor, @build = nil\n end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n dumpvers = %x{pev -p #{ntdlls.first}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n dumpvers = %x{pev -p #{file}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n majors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MAJOR/text()')\n minors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MINOR/text()')\n builds = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/BUILD/text()')\n major = majors.first # The install.wim image will have multiple sub-\n minor = minors.first # images. Check to make sure each one has the same\n build = builds.first # version number.\n if majors.count(major) == majors.size and\n minors.count(minor) == minors.size and\n builds.count(build) == builds.size then\n @major, @minor, @build = Integer(major.to_s), Integer(minor.to_s), Integer(build.to_s)\n end\n rescue Exception => e\n # puts \"error(get_build): #{e}\"\n # raise\n end\n end\n return @major, @minor, @build\n end",
"def calabash_server_version\n version = nil\n executables.each do |executable|\n version = strings(executable).server_version\n break if version\n end\n version\n end",
"def os_versions_summary\n return @os_versions_summary\n end",
"def iyyov_install\n iyyov_install_rundir\n\n if iyyov_install_gem\n iyyov_install_init!\n true\n else\n false\n end\n\n end",
"def installed?\n revision && install_path.exist?\n end",
"def info\n fetcher = Gem::SpecFetcher.new\n\n [[\"about\", MiniReadline::DESCRIPTION],\n [\"version\", MiniReadline::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_readline\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_readline\", fetcher).to_s}],\n [\"about\", MiniTerm::DESCRIPTION],\n [\"version\", MiniTerm::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mini_term\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mini_term\", fetcher).to_s}],\n [\"platform\", MiniTerm::TERM_PLATFORM.inspect],\n [\"term type\", MiniTerm::TERM_TYPE.inspect],\n [\"columns\", MiniTerm.width.to_s],\n [\"rows\", MiniTerm.height.to_s],\n [\"code page\", if MiniTerm.windows?; (`chcp`); end],\n [\"term\", ENV['TERM']],\n [\"disp\", ENV['DISPLAY']],\n [\"edit\", ENV['EDITOR']]\n ]\n end",
"def version_type(version)\n data = Settings::ProgramSettings.new.parse(\"https://github.com/Ekultek/whitewidow/blob/master/lib/misc/banner.rb\", \"td\", 57)\n arr = data.split(\" \")\n version_number = arr[7][/(\\d+\\.)?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)/]\n if version.count(\".\") <= 2\n return \"stable\".green.bold\n elsif version.length >= 3\n return \"dev\".yellow.bold\n elsif version != version_number\n return \"upgrade available\".red.bold\n else\n return \"unknown version type\".red.bold\n end\n\n end",
"def versionControlStatus\n if (File.exist?(File.join(@path, \".git\")))\n gitStatus\n elsif (File.exist?(File.join(@path, \".svn\")))\n svnStatus\n elsif (File.exist?(File.join(@path, \".hg\")))\n hgStatus\n else\n {:name => \"(none)\", :status => \"No version control.\"}\n end\n end",
"def productVersion \n \"productVersion\" \n end",
"def installed_version\n res = Chef::Resource::Package.new('chefdk', run_context)\n prov = Chef::Provider::Package::Dpkg.new(res, run_context)\n ver = prov.load_current_resource.version.first\n return false if ver.nil?\n ver = ver.split('-').first\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def print_version_info()\n puts \"Versão: \" + $version_info[:version].to_s + \" \" + $version_info[:date].to_s\n puts \"-----\"\nend",
"def get_local_version(ssh_session,filename)\n (ssh_session,local_version) = ssh_session_exec(ssh_session,\"esxcli software vib list |grep 'esx-base' |awk '{print $2}'\")\n local_version = local_version.chomp\n if $verbose_mode == true\n puts \"vSphere release: \"+local_version\n end\n return ssh_session,local_version\nend",
"def read_device_version()\n execute_command('F83', false, @status_debug_msg)\n end",
"def version_installed()\n droplet=droplet_file_path()\n return unless droplet\n version_available_file = version_available_file_path()\n unless version_available_file\n puts \"Don't know what file stores the version installed of #{@current_name}\" if VMC::Cli::Config.trace\n return\n end\n cmd = cmd_read_version_installed()\n unless cmd\n puts \"Don't know how to read the version installed with a cmd.\" if VMC::Cli::Config.trace\n return\n end\n puts \"Looking for the installed version here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n puts \" with cmd #{cmd}\" if VMC::Cli::Config.trace\n droplet_dot_version=\"#{droplet}.version\"\n unless File.exists? droplet_dot_version\n Dir.chdir(\"/tmp\") do\n `[ -f #{version_available_file} ] && rm #{version_available_file}`\n `tar -xzf #{droplet} #{version_available_file}`\n if File.exist?(version_available_file)\n `cp #{version_available_file} #{droplet_dot_version}`\n else\n put \"Could not find the installed version file here: here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n end\n end\n end\n installed_version=read_version(droplet_dot_version,cmd)\n end",
"def win_bin?\n new_resource.version.split('.')[0].to_i > 1\nend",
"def installed_version(packagename)\n\t\t\t\treturn(installed_packages()[packagename].version)\t\t\t\t\n\t\t\tend",
"def versions\n installs.map { |i| i['version'] }.uniq\n end",
"def versions\n installs.map { |i| i['version'] }.uniq\n end",
"def versions\n installs.map { |i| i['version'] }.uniq\n end",
"def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end",
"def init\n @flavor = 'mac_os_x'\n @release = `sw_vers -productVersion`\n end",
"def upgrade_app_explain; \"Check for updates to Hobix.\"; end",
"def setup\n required_version = YAML.load_file(\"#{@repository_path}/chef_versions.yml\")['workstation']\n Bundler.with_unbundled_env do\n exit_status, stdout, _stderr = @cmd_runner.run_cmd '/opt/chef-workstation/bin/chef --version', expected_code: [0, :command_error]\n existing_version =\n if exit_status == :command_error\n 'not installed'\n else\n expected_match = stdout.match(/^Chef Workstation version: (.+)\\.\\d+$/)\n expected_match.nil? ? 'unreadable' : expected_match[1]\n end\n log_debug \"Current Chef version: #{existing_version}. Required version: #{required_version}\"\n @cmd_runner.run_cmd \"curl -L https://omnitruck.chef.io/install.sh | #{@cmd_runner.root? ? '' : 'sudo '}bash -s -- -P chef-workstation -v #{required_version}\" unless existing_version == required_version\n end\n end",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def chef_installed?(connection, chef_version, logger)\n ssh_exec(connection, 'chef-solo --version', logger).and_then do |output|\n if output.include?(chef_version)\n Result.ok(:installed)\n else\n Result.error('Chef is not installed')\n end\n end.success?\n end",
"def major_version; end",
"def version\n p\n version = File.read(HOSTER_PATH+\"/hoster.version\")\n puts PROGNAME + \" version \" + version\nend",
"def version_to_install\n return config[:bootstrap_version] if config[:bootstrap_version]\n\n if config[:channel] == \"stable\"\n Chef::VERSION.split(\".\").first\n else\n \"latest\"\n end\n end",
"def info\n [[\"about\", Mysh::DESCRIPTION],\n [\"version\", Mysh::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mysh\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mysh\").to_s}],\n [\"init file\", $mysh_init_file.to_host_spec],\n [\"user\", ENV['USER']],\n [\"home\", (ENV['HOME'] || \"\").to_host_spec],\n [\"name\", (t = MNV[:name]).empty? ? $PROGRAM_NAME.to_host_spec : t],\n [\"os shell\", (ENV['SHELL'] || ENV['ComSpec'] || \"\").to_host_spec],\n [\"host\", ENV['HOSTNAME'] || ENV['COMPUTERNAME']],\n [\"os\", ENV['OS']],\n [\"platform\", MiniTerm::TERM_PLATFORM],\n [\"java?\", MiniTerm.java? ? true : false],\n [\"PID\", $PROCESS_ID]\n ]\n end",
"def fetch_installed_vibs\n Puppet.debug(\"Getting list of installed VIBs...\")\n cnt = 0\n host.esxcli.software.vib.get.each do |installed_vib_data|\n if installed_vib_data[:ID]\n @processed_vibs[installed_vib_data[:ID]] = installed_vib_data\n cnt += 1\n end\n end\n Puppet.debug(\"Found %d installed VIBs\" % cnt)\n end",
"def get_current_version(package)\n command = \"apt-cache policy #{package} | grep --color=never 'Installed'\"\n raw = `#{command}`.strip\n return nil if raw == ''\n\n version = raw.gsub('Installed: ', '')\n return nil if version == '(none)'\n\n version\n end",
"def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end",
"def install_vib(qualified_path)\n # Note: This is odd, the ESX hostagent API can handle arrays, but the VirtualCenter API does not\n if vim.serviceInstance.content.about.apiType == \"HostAgent\"\n qualified_path = qualified_path.is_a?(Array) ? qualified_path : [qualified_path]\n end\n component = qualified_path.is_a?(Array) ? qualified_path.first : qualified_path\n install_param = component =~ /zip$/ ? :depot : :viburl\n Puppet.debug(\"%s: Installing %s: %s\" % [Time.now, install_param, qualified_path.to_s])\n\n if component =~ /zip$/\n # if the depot file is passed, treat it as an OS upgrade as long as profile exists\n begin\n sources_raw_data = host.esxcli.software.sources.profile.list(:depot => qualified_path)\n profile_name = sources_raw_data.first.Name\n\n # TODO: reenable this line later --> return host.esxcli.software.profile.update(install_param => qualified_path, :profile => profile_name)\n return host.esxcli.software.profile.update(install_param => qualified_path, :profile => profile_name, :nosigcheck => true)\n rescue\n # skip if the result is a \"[MetadataDownloadError]\"; it will cause parsing error\n Puppet.debug(\"%s is not a valid depot for ESXi OS upgrade. Continue and treat it as a batch of vibs..\" % qualified_path)\n end\n end\n\n # TODO: reenable this line later --> host.esxcli.software.vib.install(install_param => qualified_path, :nosigcheck => @resource[:no_sign_check])\n host.esxcli.software.vib.install(install_param => qualified_path, :nosigcheck => true)\n end",
"def installed?\n source_api.number_of_units.positive? && positive_availability?\n end",
"def compare_versions(local_version,depot_version,mode)\n if local_version.match(/-/)\n local_version = local_version.split(/-/)[1]\n end\n if depot_version.match(/-/)\n depot_version = depot_version.split(/-/)[1]\n end\n puts \"Current: \"+local_version\n puts \"Available: \"+depot_version\n if mode =~ /up|check/\n avail_fw = compare_ver(local_version,depot_version)\n if avail_fw.to_s != local_version.to_s\n puts \"Depot patch level is newer than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n else\n if depot_version.to_i < local_version.to_i\n puts \"Depot patch level is lower than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n end\n if mode == \"check\"\n exit\n end\n return update_available\nend",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n # we have to \"resolve\" partial versions like \"12\" through mixlib-install before comparing them here\n des_version =\n if new_resource.download_url_override\n # probably in an air-gapped environment.\n Mixlib::Versioning.parse(desired_version)\n else\n Mixlib::Versioning.parse(Array(mixlib_install.artifact_info).first.version)\n end\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend",
"def status\n response = nexus.get(nexus_url(\"service/local/status\"))\n case response.status\n when 200\n doc = Nokogiri::XML(response.content).xpath(\"/status/data\")\n data = Hash.new\n data['app_name'] = doc.xpath(\"appName\")[0].text\n data['version'] = doc.xpath(\"version\")[0].text\n data['edition_long'] = doc.xpath(\"editionLong\")[0].text\n data['state'] = doc.xpath(\"state\")[0].text\n data['started_at'] = doc.xpath(\"startedAt\")[0].text\n data['base_url'] = doc.xpath(\"baseUrl\")[0].text\n return data\n when 401\n raise PermissionsException\n when 503\n raise CouldNotConnectToNexusException\n else\n raise UnexpectedStatusCodeException.new(response.status)\n end\n end",
"def binary_version; end",
"def v71\n fetch_version(:v71)\n end",
"def resource_version\n version_file = ::File.join(install_dir, '.ts3-version')\n if ::File.exist?(version_file)\n result = ::File.read(version_file)\n else\n result = '0'\n end\n result\nend",
"def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end",
"def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end"
] | [
"0.65920764",
"0.6492375",
"0.6228614",
"0.6226467",
"0.62157106",
"0.6153386",
"0.60666376",
"0.6062232",
"0.59915894",
"0.5972858",
"0.59472924",
"0.5882265",
"0.5882265",
"0.58814156",
"0.58716506",
"0.58619106",
"0.5793718",
"0.57850903",
"0.5761583",
"0.5761583",
"0.5750872",
"0.57401365",
"0.57308644",
"0.5715116",
"0.5713961",
"0.5688208",
"0.56655025",
"0.56619835",
"0.5661864",
"0.56501585",
"0.5648615",
"0.5639043",
"0.5637653",
"0.5630355",
"0.5622122",
"0.56115824",
"0.5607425",
"0.5596522",
"0.5585107",
"0.5584367",
"0.55840343",
"0.5576538",
"0.5559887",
"0.55378515",
"0.5523523",
"0.55164826",
"0.55096346",
"0.55087596",
"0.5505425",
"0.5502721",
"0.55016625",
"0.5500217",
"0.5481541",
"0.54703104",
"0.54696053",
"0.5466498",
"0.54631096",
"0.54550946",
"0.54530483",
"0.54517865",
"0.5445932",
"0.54319817",
"0.5429988",
"0.54259294",
"0.54204535",
"0.5418482",
"0.5414606",
"0.54144555",
"0.5403813",
"0.5401401",
"0.5398019",
"0.5395317",
"0.5395019",
"0.5392365",
"0.53913903",
"0.53913903",
"0.53913903",
"0.5388008",
"0.53840256",
"0.5382521",
"0.53788084",
"0.53756636",
"0.53733206",
"0.5371949",
"0.5369852",
"0.5366519",
"0.5365548",
"0.53610593",
"0.53571767",
"0.53541327",
"0.5352808",
"0.5338832",
"0.5337684",
"0.5333608",
"0.5321809",
"0.53210473",
"0.5313064",
"0.5311484",
"0.5307578",
"0.5307578"
] | 0.6841805 | 0 |
Functions to determine install status and version for the WAS plugin | def ihs_plg_installed?
get_version = node['ihs']['plugin']['install_dir'] + '/bin/versionInfo.sh'
begin
!/^PLG\s+installed$/.match(shell_out(get_version).stdout).to_s.empty?
rescue Errno::ENOENT => e
Chef::Log.info "File not found: #{get_version}, error: #{e}"
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installed_version\n logger.trace(\"#{new_resource} checking package version\")\n current_installed_version\n end",
"def wp_install_version_check(site=@site, verbose=true)\n @wp_paths.each do |p|\n installer = site.sub(/\\/$/, '') + p + '/INSTALL.html'\n res = @http.get(installer)\n if res[0] =~ /for (WordPress \\d+.\\d+?.?\\d+)<\\/title>/i\n wp_version = $1.chomp\n print_good(\"#{p}/INSTALL.html Found!\") if verbose\n print_line(\" Version: #{wp_version}\") if verbose\n return wp_version\n elsif res[0] =~ /<br \\/> Version (.*)/\n wp_version = $1.chomp\n print_good(\"#{p}/INSTALL.html Found!\") if verbose\n print_line(\" Version: #{wp_version}\") if verbose\n return wp_version\n end\n end\n print_error(\"/INSTALL.html Not Found!\") if verbose\n return nil\n end",
"def get_install_status\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def software_status(opts)\n opts = check_params(opts,[:installation_ids])\n super(opts)\n end",
"def get_version_info\n if defined?(Sensu::Enterprise::VERSION)\n [\"enterprise\", Sensu::Enterprise::VERSION]\n else\n [\"core\", Sensu::VERSION]\n end\n end",
"def installed_versions; end",
"def installed\n api.get('installed')\n end",
"def installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end",
"def win_bin?\n new_resource.version.split('.')[0].to_i > 1\nend",
"def status\n version.status\n end",
"def status\n version.status\n end",
"def check_installed\n @install_array = []\n cmd = \"\\\"#{webpicmd}\\\" /List /ListOption:Installed\"\n cmd << \" /XML:#{node['webpi']['xmlpath']}\" if node['webpi']['xmlpath']\n cmd_out = shell_out(cmd, returns: @new_resource.returns)\n if cmd_out.stderr.empty?\n @new_resource.product_id.split(',').each do |p|\n # Example output\n # HTTPErrors IIS: HTTP Errors\n # Example output returned via grep\n # \\r \\rHTTPErrors IIS: HTTP Errors\\r\\ns\n if cmd_out.stdout.lines.grep(/^\\s{6}#{p}\\s.*$/i).empty?\n @install_array << p\n end\n end\n else\n Chef::Log.info(cmd_out.stderr)\n @install_array = @new_resource.product_id\n end\n @install_list = @install_array.join(',')\n end",
"def installed_version\n lines = powershell_out!('Get-WmiObject -Class win32_product')\n .stdout.lines\n idx = lines.index do |l|\n l.match(/^\\W*Name\\W+:\\W+Chef Development Kit/)\n end\n return false if idx.nil?\n ver = lines[idx + 2].match(/:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end",
"def get_loc_ver(app_name)\n loc_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_loc_ver(app_name)\")\n if loc_ver.to_s.match(/Installed/)\n loc_ver = \"Not Installed\"\n end\n return loc_ver\nend",
"def swversion\n config[\"swversion\"]\n end",
"def installation\n mode == \"installation\" || mode == \"autoinstallation\" ||\n mode == \"live_installation\"\n end",
"def installed?\n !installed_version.nil?\n end",
"def software_installed?(name)\n result = execute_with_result('type', name)\n result and /\\A(#{name})(.)+(#{name})$/.match(result).to_a.count >= 3\n end",
"def Check_OS_Version()\n\tos_version = `ver`\n\treturn os_version\nend",
"def install_date\n in_service_date\n end",
"def installed_version\n capture(\"#{chef_solo} -v || true\") =~ /Chef: (\\d+\\.\\d+\\.\\d+)/ ? $1 : nil\n end",
"def what_is_installed?\n which_os = os.green\n package_manager = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n exe_installed = ( pianobar? ? 'Yes'.green : 'No'.red.blink )\n ctl_file = ( ctl? ? 'Yes'.green : 'No'.red.blink )\n has_notifier = ( notify? ? 'Yes'.green : 'No'.red.blink )\n ok = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n\n puts get_template 'what_is_installed', binding\n\n has_installer?\n end",
"def installed_version\n sh = shell_out('pkgutil --pkg-info com.getchef.pkg.chefdk')\n return false if sh.exitstatus.nonzero?\n ver = sh.stdout.match(/^version:\\W+([0-9]+\\.[0-9]+\\.[0-9]+)$/)[1]\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def productVersion \n \"productVersion\" \n end",
"def get_build\n if defined?(@major) and defined?(@minor) and defined?(@build) then\n return @major, @minor, @build\n else\n @major, @minor, @build = nil\n end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n dumpvers = %x{pev -p #{ntdlls.first}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n dumpvers = %x{pev -p #{file}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n majors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MAJOR/text()')\n minors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MINOR/text()')\n builds = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/BUILD/text()')\n major = majors.first # The install.wim image will have multiple sub-\n minor = minors.first # images. Check to make sure each one has the same\n build = builds.first # version number.\n if majors.count(major) == majors.size and\n minors.count(minor) == minors.size and\n builds.count(build) == builds.size then\n @major, @minor, @build = Integer(major.to_s), Integer(minor.to_s), Integer(build.to_s)\n end\n rescue Exception => e\n # puts \"error(get_build): #{e}\"\n # raise\n end\n end\n return @major, @minor, @build\n end",
"def get_rpm_status(proj_info)\n if proj_info.type == :module\n # FIXME This ASSUMES the release qualifier is 0 instead of using\n # simp-core/build/rpm/dependencies.yaml.\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-0.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n else\n # FIXME If the RPM release qualifier has a %dist macro in it, there\n # is no way to accurately extract it from the spec file. The logic\n # below is a hack!\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-#{proj_info.release}.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el6.gsub!('el7','el6')\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n url_el7.gsub!('el6','el7')\n end\n\n # query PackageCloud to see if a release to both el6 and el7 repos has been made\n # Note that each URL is for a page with a download button, not the RPM itself.\n debug(\"Checking existence of #{url_el6}: #{url_exists?(url_el6) ? 'exists' : 'does not exist'}\")\n debug(\"Checking existence of #{url_el7}: #{url_exists?(url_el7) ? 'exists' : 'does not exist'}\")\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_released = rpms_found ? :released : :unreleased\n rpms_released\n end",
"def get_rpm_status(proj_info)\n if proj_info.type == :module\n # FIXME This ASSUMES the release qualifier is 0 instead of using\n # simp-core/build/rpm/dependencies.yaml.\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-0.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n else\n # FIXME If the RPM release qualifier has a %dist macro in it, there\n # is no way to accurately extract it from the spec file. The logic\n # below is a hack!\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-#{proj_info.release}.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el6.gsub!('el7','el6')\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n url_el7.gsub!('el6','el7')\n end\n\n # query PackageCloud to see if a release to both el6 and el7 repos has been made\n # Note that each URL is for a page with a download button, not the RPM itself.\n debug(\"Checking existence of #{url_el6}: #{url_exists?(url_el6) ? 'exists' : 'does not exist'}\")\n debug(\"Checking existence of #{url_el7}: #{url_exists?(url_el7) ? 'exists' : 'does not exist'}\")\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_released = rpms_found ? :released : :unreleased\n rpms_released\n end",
"def resource_version\n version_file = ::File.join(install_dir, '.ts3-version')\n if ::File.exist?(version_file)\n result = ::File.read(version_file)\n else\n result = '0'\n end\n result\nend",
"def has_version?; end",
"def status\n #does the plugin exist?\n if File.directory?(File.join(@plugin_path, '.git'))\n #okay...exists.. compare hashes\n if type == 1\n @remote_hash != @plugin_head ? 1 : 2\n else\n 3\n end\n else \n 0\n end\n end",
"def installed?\n revision && install_path.exist?\n end",
"def get_nameprog_swversion\r\n nomeprog = APP_CUPERATIVA_NAME\r\n ver_prog = CuperativaGui.sw_version_to_int\r\n return nomeprog, ver_prog\r\n end",
"def get_version\n\t\tend",
"def get_version()\n\t\tend",
"def installation?; @installation; end",
"def current_version?\n version == FirmwareUpgrade.current_software_version\n end",
"def yosemite_or_newer?\n Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('10.10')\nend",
"def prepare_for_installation; end",
"def install_summary\n return @install_summary\n end",
"def check_version\n temp_file = \"/tmp/awsssh_version_check\"\n if File.exists?(temp_file)\n if ((Time.now - File.mtime(temp_file)) / (60 * 60 * 2)).to_i != 0 # check all 2h\n check = true\n else\n check = false\n end\n else\n check = true\n end\n if check\n begin\n rubygems = JSON.parse(open(\"https://rubygems.org/api/v1/versions/awsssh/latest.json\").read)\n if rubygems[\"version\"] != VERSION\n puts \" ############################################\".colorize(:red)\n puts \" # You're using an old version of this gem! #\".colorize(:red)\n puts \" # Run `gem update awsssh` #\".colorize(:red)\n puts \" ############################################\".colorize(:red)\n puts\n end\n rescue\n ensure\n FileUtils.touch(temp_file)\n end\n end\n end",
"def component_versions(cmp)\n component_build_vars(cmp)['PACKAGE_VERSIONS']\nend",
"def confirmInstallation\n heading = \"\"\n body = \"\"\n confirm_button_label = \"\"\n\n if !Mode.update\n # Heading for confirmation popup before the installation really starts\n heading = HTML.Heading(_(\"Confirm Installation\"))\n\n # Text for confirmation popup before the installation really starts 1/3\n body = _(\n \"<p>Information required for the base installation is now complete.</p>\"\n )\n\n some_destructive = Builtins.find(Storage.GetCommitInfos) do |info|\n Ops.get_boolean(info, :destructive, false)\n end != nil\n\n if some_destructive\n # Text for confirmation popup before the installation really starts 2/3\n body = Ops.add(\n body,\n _(\n \"<p>If you continue now, <b>existing\\n\" +\n \"partitions</b> on your hard disk will be <b>deleted</b> or <b>formatted</b>\\n\" +\n \"(<b>erasing any existing data</b> in those partitions) according to the\\n\" +\n \"installation settings in the previous dialogs.</p>\"\n )\n )\n else\n # Text for confirmation popup before the installation really starts 2/3\n body = Ops.add(\n body,\n _(\n \"<p>If you continue now, partitions on your\\n\" +\n \"hard disk will be modified according to the installation settings in the\\n\" +\n \"previous dialogs.</p>\"\n )\n )\n end\n\n # Text for confirmation popup before the installation really starts 3/3\n body = Ops.add(\n body,\n _(\"<p>Go back and check the settings if you are unsure.</p>\")\n )\n\n confirm_button_label = Label.InstallButton\n else\n # Heading for confirmation popup before the update really starts\n heading = \"<h3>\" + _(\"Confirm Update\") + \"</h3>\"\n\n body =\n # Text for confirmation popup before the update really starts 1/3\n _(\"<p>Information required to perform an update is now complete.</p>\") +\n # Text for confirmation popup before the update really starts 2/3\n _(\n \"\\n\" +\n \"<p>If you continue now, data on your hard disk will be overwritten\\n\" +\n \"according to the settings in the previous dialogs.</p>\"\n ) +\n # Text for confirmation popup before the update really starts 3/3\n _(\"<p>Go back and check the settings if you are unsure.</p>\") \n\n\n # Label for the button that confirms startint the installation\n confirm_button_label = _(\"Start &Update\")\n end\n\n heading_bg_color = \"#A9CEDD\"\n\n display_info = UI.GetDisplayInfo\n text = Ops.get_boolean(display_info, \"RichTextSupportsTable\", false) ?\n Builtins.sformat(\n \"<table bgcolor=\\\"%1\\\"><tr><td>%2</td></tr></table>%3\",\n heading_bg_color,\n heading,\n body\n ) :\n Ops.add(heading, body)\n\n size_x = Builtins.tointeger(Ops.get_integer(display_info, \"Width\", 800))\n size_y = Builtins.tointeger(Ops.get_integer(display_info, \"Height\", 600))\n\n # 576x384 support for for ps3\n # bugzilla #273147\n if Ops.greater_or_equal(size_x, 800) && Ops.greater_or_equal(size_y, 600)\n size_x = 70\n size_y = 18\n else\n size_x = 54\n size_y = 15\n end\n\n UI.OpenDialog(\n VBox(\n VSpacing(0.4),\n HSpacing(size_x), # force width\n HBox(\n HSpacing(0.7),\n VSpacing(size_y), # force height\n RichText(text),\n HSpacing(0.7)\n ),\n ButtonBox(\n PushButton(\n Id(:cancel),\n Opt(:cancelButton, :key_F10, :default),\n Label.BackButton\n ),\n PushButton(Id(:ok), Opt(:okButton, :key_F9), confirm_button_label)\n )\n )\n )\n\n button = Convert.to_symbol(UI.UserInput)\n UI.CloseDialog\n\n button == :ok\n end",
"def installed_plugins\n @data[\"installed\"]\n end",
"def available_versions\n Mixlib::Install.available_versions(project, channel)\n end",
"def check_install?\n @default_options[ :check_install ]\n end",
"def installed_version\n res = Chef::Resource::Package.new('chefdk', run_context)\n prov = Chef::Provider::Package::Dpkg.new(res, run_context)\n ver = prov.load_current_resource.version.first\n return false if ver.nil?\n ver = ver.split('-').first\n ver == package_metadata[:version] ? 'latest' : ver\n end",
"def check\r\n res = send_request_cgi({\r\n 'uri' => normalize_uri(\"configurations.do\"),\r\n 'method' => 'GET'\r\n })\r\n\r\n if res && res.code == 200\r\n build = nil\r\n\r\n if res.body.to_s =~ /ManageEngine Desktop Central 7/ ||\r\n res.body.to_s =~ /ManageEngine Desktop Central MSP 7/ # DC v7\r\n\r\n print_status(\"#{peer} - Detected Desktop Central v7\")\r\n elsif res.body.to_s =~ /ManageEngine Desktop Central 8/ ||\r\n res.body.to_s =~ /ManageEngine Desktop Central MSP 8/\r\n\r\n if res.body.to_s =~ /id=\"buildNum\" value=\"([0-9]+)\"\\/>/ # DC v8 (later versions)\r\n build = $1\r\n print_status(\"#{peer} - Detected Desktop Central v8 #{build}\")\r\n else # DC v8 (earlier versions)\r\n print_status(\"#{peer} - Detected Desktop Central v8\")\r\n end\r\n elsif res.body.to_s =~ /id=\"buildNum\" value=\"([0-9]+)\"\\/>/ # DC v9 (and higher?)\r\n build = $1\r\n end\r\n\r\n if build.nil?\r\n return Exploit::CheckCode::Unknown\r\n elsif Gem::Version.new(build) < Gem::Version.new(\"90055\")\r\n return Exploit::CheckCode::Appears\r\n else\r\n return Exploit::CheckCode::Safe\r\n end\r\n end\r\n\r\n Exploit::CheckCode::Unknown\r\n end",
"def version_needed_to_extract\n 0x0014\n end",
"def version_needed_to_extract\n 0x0014\n end",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n # we have to \"resolve\" partial versions like \"12\" through mixlib-install before comparing them here\n des_version =\n if new_resource.download_url_override\n # probably in an air-gapped environment.\n Mixlib::Versioning.parse(desired_version)\n else\n Mixlib::Versioning.parse(Array(mixlib_install.artifact_info).first.version)\n end\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend",
"def version_to_install\n return config[:bootstrap_version] if config[:bootstrap_version]\n\n if config[:channel] == \"stable\"\n Chef::VERSION.split(\".\").first\n else\n \"latest\"\n end\n end",
"def version\n @plugin_version ||= if @event.at('plugin_version')\n @event.at('plugin_version').inner_text\n else\n false\n end\n end",
"def version_installed()\n droplet=droplet_file_path()\n return unless droplet\n version_available_file = version_available_file_path()\n unless version_available_file\n puts \"Don't know what file stores the version installed of #{@current_name}\" if VMC::Cli::Config.trace\n return\n end\n cmd = cmd_read_version_installed()\n unless cmd\n puts \"Don't know how to read the version installed with a cmd.\" if VMC::Cli::Config.trace\n return\n end\n puts \"Looking for the installed version here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n puts \" with cmd #{cmd}\" if VMC::Cli::Config.trace\n droplet_dot_version=\"#{droplet}.version\"\n unless File.exists? droplet_dot_version\n Dir.chdir(\"/tmp\") do\n `[ -f #{version_available_file} ] && rm #{version_available_file}`\n `tar -xzf #{droplet} #{version_available_file}`\n if File.exist?(version_available_file)\n `cp #{version_available_file} #{droplet_dot_version}`\n else\n put \"Could not find the installed version file here: here #{droplet} // #{version_available_file}\" if VMC::Cli::Config.trace\n end\n end\n end\n installed_version=read_version(droplet_dot_version,cmd)\n end",
"def check_version\n var_error = nil\n status = 'ok'\n begin\n Provider.first\n rescue => error\n var_error = error\n status = 'fail'\n end\n version_message ='%s version %s is up and running at %s:%s.' % [\n 'Onestop Provisioning App', SERVER_CONFIGURATION[\"onestop_code_version\"], request.host, request.port ]\n if var_error.nil?\n db_status = \"Onestop Provisioning is connected to database on account ID #{ActiveRecord::Base.connection_config[:username]}\"\n else\n db_status = \"Onestop Provisioning is currently experiencing problems with connecting to database. Error: #{var_error}\"\n end\n render json: { version_message: version_message + db_status, status: status, api_version: SERVER_CONFIGURATION[\"onestop_code_version\"], server_instance_name: ServerConfiguration::CONFIG['onestop_server_instance_name'] }\n end",
"def installed?\n source_api.number_of_units.positive? && positive_availability?\n end",
"def get_version(apps)\n apps.each do |app|\n if File.exists?(\"#{app}/Contents/Info.plist\")\n short = app.sub(/\\/Applications\\//, '')\n vers = `/usr/bin/defaults read \"#{app}\"/Contents/Info CFBundleShortVersionString`.chomp\n res = puts \"#{short}: #{vers}\"\n $?.success? ? res : \"ERROR: could not get version\"\n else\n puts \"#{app} is not installed.\"\n end\n end\nend",
"def test_Enviroment_008_watirworks_install_path\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_008_watirworks_install_path\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"WatirWorks install path: \" + get_watirworks_install_path)\r\n\r\n end",
"def server_version\n status['value']['build']['version']\n end",
"def get_depot_version(ssh_session,filename,depot_url,os_version)\n if !filename.match(/[A-z]/)\n (ssh_session,output) = ssh_session_exec(ssh_session,\"esxcli network firewall ruleset set -e true -r httpClient\")\n (ssh_session,depot_version) = ssh_session_exec(ssh_session,\"esxcli software sources vib list -d #{depot_url} 2>&1 | grep '#{os_version}' |grep 'esx-base' |grep Update |awk '{print $2}' |tail -1\")\n if !depot_version\n (ssh_sessionm,depot_version) = ssh_session_exec(ssh_session,\"esxcli software sources vib list -d #{depot_url} 2>&1 | grep '#{os_version}' |grep 'esx-base' |grep Installed |awk '{print $2}' |tail -1\")\n end\n depot_version = depot_version.chomp \n else\n tmp_dir = \"/tmp/esxzip\"\n if !File.directory?(tmp_dir)\n Dir.mkdir(tmp_dir)\n end\n %x[unzip -o #{filename} metadata.zip -d #{tmp_dir}]\n depot_version = %x[unzip -l #{tmp_dir}/metadata.zip |awk '{print $4}' |grep '^profiles' |grep standard].chomp\n depot_version = depot_version.split(/\\//)[1].split(\"-\")[0..-2].join(\"-\")\n end\n if $verbose_mode == true\n puts \"Depot release: \"+depot_version\n end\n return ssh_session,depot_version\nend",
"def installed_version\n raise NotImplementedError\n end",
"def installed_version(packagename)\n\t\t\t\treturn(installed_packages()[packagename].version)\t\t\t\t\n\t\t\tend",
"def get_os_version(ssh_session)\n (ssh_session,os_version) = ssh_session_exec(ssh_session,\"uname -r\")\n os_version = os_version.chomp\n if $verbose_mode == true\n puts \"vSphere version: \"+os_version\n end\n return ssh_session,os_version\nend",
"def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end",
"def ihs_installed?\n get_version = node['ihs']['install_dir'] + '/bin/versionInfo.sh'\n\n begin\n !/^IHS\\s+installed$/.match(shell_out(get_version).stdout).to_s.empty?\n rescue Errno::ENOENT => e\n Chef::Log.info \"File not found: #{get_version}, error: #{e}\"\n return false\n end\n end",
"def init\n @flavor = 'mac_os_x'\n @release = `sw_vers -productVersion`\n end",
"def check_for_installed_software_only\n check_all_installed @options\n end",
"def check_ai_pkg_repo(options,p_struct,pkg_name,pkg_repo_dir)\n pkg_version=p_struct[pkg_name].version\n message = \"Information:\\tChecking if repository contains \"+pkg_name+\" \"+pkg_version\n command = \"pkg info -g #{pkg_repo_dir} -r #{pkg_name} |grep Version |awk \\\"{print \\\\\\$2}\\\"\"\n output = execute_command(options,message,command)\n repo_pkg_version = output.chomp\n return repo_pkg_version\nend",
"def ic_version_if_changed\n return nil if do_not_check_for_version_change\n if step_not_modified\n begin\n # ae = application_environment\n ae = []\n request.apps.each do |app|\n ae << app.application_environments.find_by_environment_id(request.environment_id)\n end\n # ac = application_component\n ac = []\n ae.each do |app_env|\n ac << app_env.application_components.find_by_component_id(component_id)\n end\n ae.flatten!\n ac.flatten!\n # ic = installed_component\n ic = InstalledComponent.find_by_application_component_id_and_application_environment_id(ac.map(&:id), ae.map(&:id))\n ic.nil? ? nil : (ic.version.eql?(version_name) ? nil : ic.version)\n rescue\n nil\n end\n end\n end",
"def check\r\n vprint_status 'STEP 0: Get rConfig version...'\r\n res = send_request_cgi!(\r\n 'method' => 'GET',\r\n 'uri' => '/login.php'\r\n )\r\n if !res || !res.get_html_document\r\n fail_with(Failure::Unknown, 'Could not check rConfig version')\r\n end\r\n if res.get_html_document.at('div[@id=\"footer-copyright\"]').text.include? 'rConfig Version 3.9'\r\n print_good('rConfig version 3.9 detected')\r\n return Exploit::CheckCode::Appears\r\n elsif res.get_html_document.at('div[@id=\"footer-copyright\"]').text.include? 'rConfig'\r\n print_status('rConfig detected, but not version 3.9')\r\n return Exploit::CheckCode::Detected\r\n end\r\n end",
"def health_check\n render json: {\n rails_version: Rails.version,\n deploy_version: ENV.fetch(\"DEPLOY_VERSION\")\n }, status: :ok\n end",
"def all_software_status\n super\n end",
"def installed?\n false\n end",
"def detect_installed_version\n return @installed_version unless self.class.method_defined?(:installed_version_file)\n\n version_match = find_first_match(:matching => installed_version_regexp, :in_file => installed_version_file)\n\n # if multiple parts are matched, join them back\n version = version_match.captures.reject(&:nil?).join(\".\")\n\n # convert commas into dots so Versionomy can parse them too\n version = version.gsub(',', '.')\n\n if version\n @installed_version_text = version.strip\n @installed_version = Versionomy.parse(@installed_version_text).change({}, :optional_fields => [:tiny])\n end\n end",
"def installed?\n secrets = @stage.get('secrets').map(&:name)\n secrets.any? { |s| s.match(/\\Ash\\.helm\\.release\\.v\\d+\\.#{Regexp.escape(name)}\\./) }\n end",
"def get_local_version(ssh_session,filename)\n (ssh_session,local_version) = ssh_session_exec(ssh_session,\"esxcli software vib list |grep 'esx-base' |awk '{print $2}'\")\n local_version = local_version.chomp\n if $verbose_mode == true\n puts \"vSphere release: \"+local_version\n end\n return ssh_session,local_version\nend",
"def get_os\n system=`/usr/bin/sw_vers -productVersion`.chomp.split(\".\").slice(1).to_i\n if system==4 then\n return \"tiger\"\n else\n return \"leo\"\n end\nend",
"def component_version(exec)\n cmd = \"#{exec} --version\"\n po = Puppet::Util::Execution.execute(cmd, combine: false)\n raise \"Exit #{po.exitstatus} running #{cmd.join(' ')}. STDOUT: #{po}\" if po.exitstatus != 0\n\n po.strip\n end",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def backup_minister_installed?\n software_installed?(APP_NAME)\n end",
"def version()\n $stderr.puts WOL_VERSION\n $stderr.puts 'Written by Kevin R. Bullock.'\n $stderr.puts\n $stderr.puts 'Copyright (C) 2004 Kevin R. Bullock.'\n $stderr.puts 'This is free software; see the source for copying conditions. There is NO'\n $stderr.puts 'warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'\n end",
"def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end",
"def knotx_installed?\n # Currently deployed JAR checksum verification\n if ::File.exist?(new_resource.install_path)\n\n new_checksum = new_resource.checksum\n current_checksum = md5sum(new_resource.install_path)\n # If checksum doesn't match deployment is required\n return true if new_checksum == current_checksum\n end\n\n # TODO: Implement additional checks for log_dir, base_dir etc.\n\n false\n end",
"def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\n end",
"def _check_for_updates\n @update_info = CCProcess.complete(\"sdk-manage --target --upgradable '#{@name}'\")\n @last_update_check = Time.now\n rescue CCProcess::Failed\n \"\"\n end",
"def version\n detect_product('GSA').version\n end",
"def print_version_info()\n puts \"Versão: \" + $version_info[:version].to_s + \" \" + $version_info[:date].to_s\n puts \"-----\"\nend",
"def current_version?\n true\n end",
"def version\n if browser == \"Chrome\"\n chrome.version\n elsif product = detect_product(\"Version\")\n product.version\n else\n BuildVersions[build]\n end\n end",
"def engine_version\n stats.version\n end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def installed_version?\n symlink_path = node['otrs']['prefix'] + \"/otrs\"\n\n if installed?\n symlink_target = File.readlink(symlink_path)\n symlink_target.sub(/.*-/, '')\n else\n nil\n end\n end",
"def available_versions\n Mixlib::Install.new(\n product_name: project_name,\n channel: channel_name.to_sym,\n user_agent_headers: ['omnitruck']\n ).available_versions\n rescue Mixlib::Install::Backend::ArtifactsNotFound\n # Return an empty array if no artifacts are found\n []\n end",
"def major_version; end",
"def wp_generator_version_check(site=@site, verbose=true)\n @wp_paths.each do |p|\n link = site.sub(/\\/$/, '') + p\n link += '/' if p == ''\n res = @http.get(site)\n if res[0] =~ /<meta name=\"generator\" content=\"(WordPress \\d+.\\d+?.?\\d+)\" \\/>/i\n wp_version = $1.chomp\n print_good(\"Generator Tag found!\") if verbose\n print_line(\" Version: #{wp_version}\") if verbose\n wp_frontpage_check(res[0]) if verbose\n if not res[3].nil? and verbose\n blah_headers = [ 'Location', 'Date', 'Content-Type', 'Content-Length', 'Connection', 'Etag', 'Expires', 'Last-Modified', 'Pragma', 'Vary', 'Cache-Control', 'X-Pingback', 'Accept-Ranges', 'Transfer-Encoding', 'Link' ]\n print_good(\"Found Interesting Headers: \")\n res[3].split(\"\\n\").each do |header_line|\n header_name = header_line.split(':')[0]\n header_value = header_line.split(':')[1..-1].join(':')\n if not blah_headers.include?(header_name) and not header_name =~ /HTTP\\/1\\.1|^:$/ and header_name.strip.chomp != ''\n print_line(\" #{header_name}: #{header_value}\")\n end\n end\n end\n return wp_version\n end\n end\n print_error(\"No Generator Tag Found!\") if verbose\n return nil\n end",
"def compare_versions(local_version,depot_version,mode)\n if local_version.match(/-/)\n local_version = local_version.split(/-/)[1]\n end\n if depot_version.match(/-/)\n depot_version = depot_version.split(/-/)[1]\n end\n puts \"Current: \"+local_version\n puts \"Available: \"+depot_version\n if mode =~ /up|check/\n avail_fw = compare_ver(local_version,depot_version)\n if avail_fw.to_s != local_version.to_s\n puts \"Depot patch level is newer than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n else\n if depot_version.to_i < local_version.to_i\n puts \"Depot patch level is lower than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n end\n if mode == \"check\"\n exit\n end\n return update_available\nend"
] | [
"0.67553914",
"0.6603389",
"0.65836024",
"0.65639526",
"0.64073455",
"0.6386622",
"0.6357007",
"0.62495327",
"0.62340003",
"0.62054306",
"0.62054306",
"0.6158589",
"0.6129734",
"0.60807186",
"0.5972702",
"0.5934518",
"0.5908741",
"0.59062755",
"0.59062374",
"0.5883202",
"0.588245",
"0.58790684",
"0.58760595",
"0.58612174",
"0.58470297",
"0.58171386",
"0.5814575",
"0.5814575",
"0.58115506",
"0.5809594",
"0.5790407",
"0.57883185",
"0.5780807",
"0.5771304",
"0.5770535",
"0.57674253",
"0.57569325",
"0.57525533",
"0.57359123",
"0.57333726",
"0.5731825",
"0.57191396",
"0.5711451",
"0.5706189",
"0.5703305",
"0.5691427",
"0.5678133",
"0.5677583",
"0.567213",
"0.567213",
"0.5668865",
"0.56614107",
"0.56593204",
"0.5658347",
"0.5655196",
"0.5654404",
"0.5630289",
"0.56285113",
"0.56156385",
"0.5613285",
"0.5613092",
"0.56073576",
"0.5604013",
"0.5593699",
"0.5584598",
"0.55605537",
"0.5556414",
"0.5555529",
"0.5546117",
"0.5536599",
"0.5536095",
"0.5534701",
"0.5528695",
"0.55217636",
"0.5517006",
"0.5513634",
"0.55134815",
"0.55122143",
"0.55121094",
"0.55119807",
"0.5510035",
"0.55060345",
"0.5502024",
"0.5499964",
"0.5499452",
"0.54941785",
"0.5489301",
"0.54851526",
"0.5476994",
"0.5463876",
"0.5462198",
"0.5462198",
"0.5462198",
"0.5462198",
"0.5462198",
"0.5462198",
"0.5454886",
"0.54536563",
"0.5451983",
"0.5451264",
"0.5444173"
] | 0.0 | -1 |
Functions to check/create prescribed installation path | def subdirs_to_create(dir, user)
Chef::Log.info("Dir to create: #{dir}, user: #{user}")
existing_subdirs = []
remaining_subdirs = dir.split('/')
remaining_subdirs.shift # get rid of '/'
until remaining_subdirs.empty?
Chef::Log.debug("remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}")
path = existing_subdirs.push('/' + remaining_subdirs.shift).join
break unless File.exist?(path)
raise "Path #{path} exists and is a file, expecting directory." unless File.directory?(path)
raise "Directory #{path} exists but is not traversable by #{user}." unless can_traverse?(user, path)
end
new_dirs = [existing_subdirs.join]
new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?
new_dirs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_exists?\n path_exists? install_dir\nend",
"def install_path(val = NULL_ARG)\n unless val.equal?(NULL_ARG)\n @install_path = windows_safe_path(val)\n end\n @install_path || raise(MissingProjectConfiguration.new('install_path', '/opt/chef'))\n end",
"def path_check!\n # When installed outside of omnibus, trust the user to configure their PATH\n return true unless omnibus_install?\n\n paths = env[path_key].split(File::PATH_SEPARATOR)\n paths.map! { |p| drive_upcase(Chef::Util::PathHelper.cleanpath(p)) }\n embed_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_embedded_bin_dir)))\n bin_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_bin_dir)))\n if embed_index\n if bin_index\n if embed_index < bin_index\n err(\"WARN: #{omnibus_embedded_bin_dir} is before #{omnibus_bin_dir} in your #{path_key}, please reverse that order.\")\n err(\"WARN: consider using `#{ChefCLI::Dist::EXEC} shell-init <shell>` command to setup your environment correctly.\")\n end\n else\n err(\"WARN: only #{omnibus_embedded_bin_dir} is present in your path, you must add #{omnibus_bin_dir} before that directory.\")\n err(\"WARN: consider using `#{ChefCLI::Dist::EXEC} shell-init <shell>` command to setup your environment correctly.\")\n end\n end\n end",
"def define_im_install_dir\n user = define_user\n case new_resource.im_install_mode\n when 'admin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/opt/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'nonAdmin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'group'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager_Group'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n end\nend",
"def define_im_install_dir\n user = define_user\n case new_resource.im_install_mode\n when 'admin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/opt/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'nonAdmin'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n when 'group'\n im_install_dir = if new_resource.im_install_dir.nil?\n '/home/' + user + '/IBM/InstallationManager_Group'\n else\n new_resource.im_install_dir\n end\n im_install_dir\n end\nend",
"def user_install_dir\n eval_path(find_val('user_install_dir') || home_dir)\n end",
"def prepare_for_installation; end",
"def define_path\n raise GetMeSubsError.new(\"Settings for this OS aren't supported.\") if @os != :windows\n @path = (\n case @os\n when :windows\n ENV['APPDATA'] + \"/GetMeSubs/settings.yaml\"\n end\n )\n FileUtils.mkdir_p(File.dirname(@path))\n end",
"def install_directory\n \"C:\\\\opscode\\\\chef\"\n end",
"def os_install_dir\n @os_install_dir\n end",
"def install_root\n self.class.install_root.join(name)\n end",
"def installed?\n File.exists?(@path)\n end",
"def prepare_install_sh\n Mixlib::Install.install_sh(base_url: url(settings.virtual_path).chomp('/'))\n end",
"def test_installed_path\n expected = File.join(@install_path, 'archive')\n assert_equal(expected, @target.installed_path)\n end",
"def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end",
"def installed?\n ::File.exist?(PATH)\n end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\nend",
"def component_install_path(cmp)\n File.join WORK_PATH, 'install', cmp\nend",
"def install_dest\n ENV[\"DOTFILES_HOME\"] || ENV[\"HOME\"]\n end",
"def install_root\n Pathname.new(ENV[\"PREFIX\"] || \"/var/www/ood/apps/sys\")\n end",
"def make_installer_gtifw exe_path\n end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\n \n #Create book zip folder\n @book_prod_final_zip_folder=@book_zip_generated_folder+\"book/\"\n if (File.exists?(@book_prod_final_zip_folder) && File.directory?(@book_prod_final_zip_folder))\n puts \"Book Prod Zip folder exists\"\n else\n Dir.mkdir(@book_prod_final_zip_folder)\n end\nend",
"def installed?\n path.exist? || path.symlink?\n end",
"def autoproj_gem_home; @private_autoproj || Gem.user_dir end",
"def set_initial_path\n `echo $PATH`.split(':').each do |path|\n add_env_path path\n end\nend",
"def generate_install_folder\n folder='./EdenApps'\n unless File.exist?(folder)\n Console.show \"Creating folder #{folder}\", 'info'\n FileUtils.mkdir_p(folder)\n FileUtils.chown_R('EdenManager','EdenManager',folder)\n FileUtils.chmod_R(0775, folder)\n end\n installFolder = \"./EdenApps/#{self.type}/#{self.name}\"\n unless File.exist?(installFolder)\n Console.show \"Creating folder #{installFolder}\", 'info'\n FileUtils.mkdir_p(installFolder)\n FileUtils.chown_R('EdenManager','EdenManager',installFolder)\n end\n installFolder\n end",
"def installer_path\n %x[which apt-get].chomp\n end",
"def test_Enviroment_008_watirworks_install_path\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_008_watirworks_install_path\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"WatirWorks install path: \" + get_watirworks_install_path)\r\n\r\n end",
"def installed_spec_directories; end",
"def installed?\n revision && install_path.exist?\n end",
"def prepare_install_ps1\n Mixlib::Install.install_ps1(base_url: url(settings.virtual_path).chomp('/'))\n end",
"def default_install_dir\n @install_dir ||= CernerSplunk::PathHelpers.default_install_dirs[package][node['os'].to_sym]\n raise \"Unsupported Combination: #{package} + #{node['os']}\" unless @install_dir\n @install_dir\n end",
"def setup_path\n if [email protected]_path.nil? and [email protected]_path.empty?\n Dir.chdir(@repo.clone_path)\n else\n initial_path_setup\n end\n end",
"def install(home)\n path = shell_installed(home)\n if path && !is_installed(path)\n File.open(path, \"a\") do |f|\n f.write(\"\\n\")\n f.write(@prepend_string)\n f.write(\"\\n\")\n f.write(@string_insert)\n f.write(\"\\n\")\n f.write(@append_string)\n f.write(\"\\n\")\n end\n end\n return path\n end",
"def checkInstall\n\t\t#create our dir if we need\n\t\tDir.mkdir(ENV['ProgramFiles'] + '/Paseya/') if !Dir.exist?(ENV['ProgramFiles'] + '/Paseya/')\n\t\tif Dir.exist?(ENV['ProgramFiles'] + '/Paseya')\n\t\t\tourPath = File.realdirpath(ENV['OCRA_EXECUTABLE']).gsub(File.basename(ENV['OCRA_EXECUTABLE']),'').to_s\n\t\t\[email protected](ourPath)\n\t\t\tdesiredPath = File.realdirpath(ENV['ProgramFiles'] + '/Paseya/').to_s \n\t\t\t\n\t\t\[email protected](desiredPath)\n\t\t\tif (desiredPath + \"/\" +@clientName).downcase != ENV['OCRA_EXECUTABLE'].downcase.gsub('\\\\','/')\n\t\t\t\[email protected]('Our client install is in ' + ENV['OCRA_EXECUTABLE'].downcase.gsub('\\\\','/'))\n\t\t\t\[email protected]('We want to be in ' + (desiredPath + \"/\" +@clientName).downcase)\n\t\t\t\tbegin\n\t\t\t\t\tPaseyaClient.installService if !Service.exists?('Paseya-client')\n\t\t\t\t\tService.stop('Paseya-client') if Service.status('Paseya-client').current_state.to_s == \"running\"\n\t\t\t\t\[email protected](Service.status('Paseya-client').current_state.to_s )\n\t\t\t\t\t#delete the old client if it exists\n\t\t\t\t\tFile.delete(desiredPath + @clientName) if File.exist?(desiredPath + @clientName)\n\t\t\t\t\tFileUtils.cp(ENV['OCRA_EXECUTABLE'],desiredPath + \"/\" +@clientName)\n\t\t\t\trescue Exception => e\n\t\t\t\t\[email protected]('Failure trying to place client executable in the proper directory')\n\t\t\t\t\[email protected](e.message)\n\t\t\t\tend\n\t\t\t\tbegin\n\t\t\t\t\t#start up the proper copy\n\t\t\t\t\tService.start('Paseya-client')\t\n\t\t\t\trescue Exception => e\n\t\t\t\t\[email protected]('Failure trying to execute service')\n\t\t\t\t\[email protected](e.message)\n\t\t\t\tend\n\t\t\t\texit\n\t\t\tend\n\t\tend\t\t\n\tend",
"def test_it_should_know_its_gem_path_with_a_default_location\n ENV.delete \"INSPEC_CONFIG_DIR\"\n ENV[\"HOME\"] = File.join(@config_dir_path, \"fakehome\")\n expected = File.join(ENV[\"HOME\"], \".inspec\", \"gems\", @ruby_abi_version)\n assert_equal expected, @installer.gem_path\n end",
"def wix_path binary\n home = ENV['WIX_HOME'].to_s\n return binary if home.empty?\n home = File.join home, 'bin', binary\n home = home.gsub '\\\\', '/'\n end",
"def get_install_directory\n # search globally and then locally to see if we can write\n @dirs.each { |dir| \n return dir if can_write_to_dir dir, true\n }\n return nil\n end",
"def outside_configured_directory?(dir); end",
"def check_requirement(requirement)\n if paths_for_extconf = Creosote::Package.installed(requirement, :default_only => true)\n puts \"requirement #{requirement} is already installed at #{paths_for_extconf.inspect}.\"\n paths_for_extconf = [paths_for_extconf].flatten\n add_extconf_args_for requirement, paths_for_extconf\n else\n puts \"requirement #{requirement} is not yet installed. Installing...\"\n paths_for_extconf = Creosote::Package.install(requirement, :default => true)\n paths_for_extconf = [paths_for_extconf].flatten\n add_extconf_args_for requirement, paths_for_extconf\n end\n end",
"def check_install(item)\n check_package(item)\n if @catagory == 'Theme'\n item_location = '/Themes'\n elsif @catagory == 'Bundle'\n item_location = '/Bundles'\n end\n FileUtils.cd(TXMP_SUPPORT_PATH + item_location)\n result = File.exists?(@filename)\n if result == true\n puts \"The monkeys found that this package is currently installed\"\n exit\n end\nend",
"def pre_install; end",
"def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app. But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/bash '\n f.puts ' '\n f.puts 'function fcomp() '\n f.puts '{ '\n f.puts ' awk -v n1=$1 -v n2=$2 \\'BEGIN{ if (n1 == n2) print \"yes\"; else print \"no\"}\\' '\n f.puts '} '\n f.puts ' '\n f.puts 'function multiplyArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' mulResult=`echo $input1 $input2 | awk \\'{printf \"%d\", $1*$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function divideArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' divResult=`echo $input1 $input2 | awk \\'{printf \"%.2f\", $1/$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function scaleArgs() '\n f.puts '{ '\n f.puts ' inputToken=$1 '\n f.puts ' factor=$2 '\n f.puts ' numberToken=`echo $inputToken | tr -cd [0-9] ` '\n f.puts ' argPrefix=`echo $inputToken | sed -e \\'s/m$//g\\' | tr -cd [a-zA-Z-+:=] ` '\n f.puts ' multiplyArgs $numberToken $factor '\n f.puts ' # Result saved in mulResult variable '\n f.puts ' scaled_number=$mulResult '\n f.puts ' scaled_token=${argPrefix}${scaled_number}m '\n f.puts '} '\n f.puts ' '\n f.puts '# There are 5 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s /home/vcap/app /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n end\n end",
"def install_dir(lib)\n if fr = ENV['FAKEROOT']\n return File.join(fr, lib)\n end\n\n lib\nend",
"def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\n end",
"def custom_directory?\n # directory exists?\n # print dir path and contents\n # return true\n # else create directory\n end",
"def install_path\n Berkshelf.cookbook_store.storage_path\n .join(\"#{dependency.name}-#{revision}\")\n end",
"def iyyov_install\n iyyov_install_rundir\n\n if iyyov_install_gem\n iyyov_install_init!\n true\n else\n false\n end\n\n end",
"def install_dir\n Crate.project.install_dir\n end",
"def already_cached?\n File.exist?(cached_installer_path) and File.zero?(cached_installer_path) == false\nend",
"def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end",
"def prepare_path\n log(\"prepare_path\")\n FileUtils.mkdir_p(path) unless Dir.exist?(path)\n rescue Exception => e\n log(\"prepare_path\", \"ERROR #{e}\")\n notify( \"reader.error\", { :error => \"prepare_path\" } )\n end",
"def install_dir\n @install_dir ||= ENV['WD_INSTALL_DIR'] || DEFAULT_INSTALL_DIR\n end",
"def install_file(source, destination)\n overwrite = overwrite? destination\n if overwrite.downcase == \"y\"\n FileUtils.copy_entry(source, destination, :preserve=>true, :remove_destination=>true)\n return true\n else\n puts \"Skipped installation of #{File.basename(source)}\"\n return false\n end\nend",
"def installed?\n if Setting.installing?.present?\n redirect_to install_index_path\n end\n end",
"def prefix\n (platform_family?('windows') ? 'C:/Chef/' : '/etc/chef/')\nend",
"def install_hack(installer)\n server_installer_name = File.basename(installer)\n return \";\" if server_installer_name.nil?\n<<SCRIPT\ncp /home/vagrant/.gitconfig /root/.gitconfig\nif [ -d \"/opt/opscode/embedded\" ]\nthen\n echo \"Bypassing server install, it appears done.\"\nelse\n echo \"PATH=/opt/opscode/embedded/bin:$PATH\" > /root/.bashrc\n sudo dpkg -i \"/installers/#{server_installer_name}\"\nfi\nSCRIPT\nend",
"def installed_path\n @installed_path ||= inferred_installed_path\n return @installed_path\n end",
"def install_dir(val = NULL)\n if null?(val)\n @install_dir || raise(MissingRequiredAttribute.new(self, :install_dir, \"/opt/chef\"))\n else\n @install_dir = val.tr('\\\\', \"/\").squeeze(\"/\").chomp(\"/\") # rubocop:disable Style/StringLiterals\n end\n end",
"def install_dir(val = NULL)\n if null?(val)\n @install_dir || raise(MissingProjectConfiguration.new('install_dir', '/opt/chef'))\n else\n @install_dir = File.expand_path(val, Config.project_root)\n end\n end",
"def default_installed_bin_dir\n if Gem.win_platform?\n # TODO: Also support Windows without cygwin\n '/cygdrive/c/Program\\ Files/Puppet\\ Labs/DevelopmentKit/bin'\n else\n '/opt/puppetlabs/bin'\n end\nend",
"def tools_home\n FilePath.new(@build_dir, \"homes\", \"tools\").ensure_directory\n end",
"def configuration_setup\n dirname = File.expand_path(USER_DIR)\n if !File.exists?(dirname)\n Dir.mkdir(dirname) \n create_storage_dir\n create_staging_dir\n create_user_conf_file\n create_user_email_conf_file\n else \n create_user_conf_file if !File.exists?(USER_CONF_FILE)\n create_storage_dir if !File.exists?(File.expand_path(STORAGE_DIR))\n create_staging_dir if !File.exists?(File.expand_path(STAGING_DIR))\n create_user_email_conf_file if !File.exists?(EMAIL_CONF_FILE)\n end\n end",
"def has_installer?\n !installer_path.nil?\n end",
"def executable_path; end",
"def install_app\n return false if File.exists?(app_dest)\n install_app!\n end",
"def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end",
"def initial_path_setup\n repo_name = @repo.repo_name.gsub(/[.]+/, '-') || @repo.repo_name\n repo_path = Rails.root.join('storage', 'repos', @repo.username, @repo.supplier_project_id.to_s, repo_name)\n FileUtils.mkdir_p(repo_path) unless File.directory?(repo_path)\n Dir.chdir(repo_path)\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.update(clone_path: repo_path)\n end\n end",
"def pkg_install\n return if @install.count == 0\n\n sysprint \"#{@name} install\"\n\n if @install[:bsys_install] != nil\n if @bsdstyle == true\n FileUtils::cd(@srcdir)\n else\n FileUtils::cd(@objdir)\n end\n\n unless sysexec(@install[:bsys_install])\n syserr \"Failed to install package\"\n raise\n end\n\n FileUtils::cd(BSYS_ROOTDIR)\n\n @install.delete(:bsys_install)\n end\n\n @install.each_pair do |src, dst|\n dst = File::join($project_rootdir, dst)\n if File::directory? src\n FileUtils::mkdir_p dst\n continue\n end\n\n # Create directory if it doesn't exists\n FileUtils::mkdir_p dst[0..-(File::basename(dst).length + 1)]\n\n if File::executable? src\n FileUtils::install(src, dst, :mode => 0755)\n else\n FileUtils::install(src, dst, :mode => 0644)\n end\n end\n end",
"def cached_installer_path\n \"./file_cache/installers/puppet-enterprise-#{pe_version}-el-7-x86_64.tar.gz\"\nend",
"def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end",
"def server_home\n FilePath.new(@build_dir, \"homes\", \"server\").ensure_directory\n end",
"def create_in_current_directory?\n is_current_directory?(@path)\n end",
"def make_relative_path\n\t\tif self.relative_path then\n\t\t\tsegments = self.relative_path.split(/\\//)\n\t\t\tpath = \"lib\"\nputs \"segments = #{segments.inspect}\"\n\t\t\tsegments.each do |seg|\n\t\t\t\tpath += \"/\" + seg\nputs \"path = #{path}\"\n\t\t\t\tbegin\n\t\t\t\t\tstat = File.stat(path)\n\t\t\t\t\tif !stat.directory? then\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\trescue Errno::ENOENT\nputs \"path not found, make dir #{path}\"\n\t\t\t\t\tDir.mkdir(path) rescue nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend",
"def users_third_party_apps_path?\n third_party_apps?\n end",
"def mkpath path\n end",
"def pathDist\n\t\"../../\" + distPackageName + \"_\" + version + \"/\"\nend",
"def ensure_exists\n create unless Dir.exist? path\n end",
"def check_install?\n @default_options[ :check_install ]\n end",
"def check_directory!\n return if File.directory?('pretend_stdenv')\n $stderr.puts \"You should run this script from the nixcrpkgs directory.\"\n dir = Pathname(__FILE__).parent\n $stderr.puts \"Try running these commands:\\n cd #{dir}\\n ./manage\"\n exit 1\nend",
"def new_dirs; end",
"def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n # Otherwise we check that the system supplied python will be sufficient\n check_system_python\n end\n end",
"def installation?; @installation; end",
"def check_for_executable; end",
"def stow_path_bin_exists?\n ::File.exist?(\"#{stow_path}/../bin/stow\")\n end",
"def setup_home_path\n\t\t\tsuper\n\n\t\t\tAWS_SUBDIRS.each do |dir|\n\t\t\t\tpath = aws_home_path.join(dir)\n\t\t\t\tnext if File.directory?(path)\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\[email protected](\"Creating: #{dir}\")\n\t\t\t\t\tFileUtils.mkdir_p(path)\n\t\t\t\trescue Errno::EACCES\n\t\t\t\t\traise Errors::HomeDirectoryNotAccessible, :home_path\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def configure(project)\n @project = project\n printf 'checking for a BSD-compatible install.. '\n if Platform.is_windows?\n puts 'not found'\n else\n @path = search() or throw 'No installer found'\n printf @path + \"\\n\"\n end\n end",
"def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend",
"def should_do_pig_install?(pig_version)\n not (File.exists?(pig_directory(pig_version)))\n end",
"def prepare_for_install(ksp_path, caveats)\n add_caveat_message!(caveats)\n @ksp_path = ksp_path\n install_prerequisites!(caveats)\n @download_dir = download_and_unzip!\n end",
"def default_install_path\n begin\n ::Rails.root.join 'config', 'initializers', ''\n rescue NameError\n File.join Dir.pwd, 'config', 'initializers', ''\n end\n end",
"def install_app!\n return false unless File.exists?(app_bak)\n\n puts \" application: #{app_dest.inspect}\"\n # FileUtils.cp_r(app_bak, app_dest)\n # the call to `FileUtils` was not copying the application icon, so I'm using\n # a call to `system` to properly copy application directories\n system(%Q/cp -r \"#{app_bak}\" \"#{app_dest}\"/)\n end",
"def install_to_directory\n # Get the current directory\n curr_dir = FileUtils::pwd + '/'\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"Installing the files to \".green + $install_dir.yellow\n puts \" (Keeping the .rb extensions) \".green if $keep_extensions\n\n # Go through the files\n files = ['deleteemailalias.rb','addemailalias.rb','listemailaliases.rb',\n 'deleteemaildomain.rb','addemaildomain.rb','deleteemailaccount.rb',\n 'listemailaccounts.rb','addemailaccount.rb','generate_password.rb']\n files.each { |f|\n # Remove the extenstion (unless we should keep it)\n nf = $keep_extensions ? f : f[0..-4]\n\n # Tell the user\n puts \"> Linking \".green + \"#{curr_dir}#{f}\".yellow + ' to '.green + \"#{$install_dir}#{nf}\".yellow\n\n if $force_install\n puts \"Forcing the install of #{nf}!\".red\n # Link the file\n fu.ln_sf curr_dir + f, $install_dir + nf\n else\n begin\n # Link the file\n fu.ln_s curr_dir + f, $install_dir + nf\n rescue Exception => e\n puts \"Couldn't link the file:\".pink\n puts e.message.red\n next\n end\n end\n\n puts \"> Adding 'execute permission' to the file\".green\n # adding \"execute permission\"\n fu.chmod \"a+x\", $install_dir + nf\n }\n\nend",
"def config_repo_installed?\n cmd_test %{-d \"#{config_path}\"}\nend",
"def pre_configure\n super\n @path ||= \"#{ENV['HOME']}/backups\"\n end",
"def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end",
"def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end",
"def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end",
"def omnibus_expand_path(*paths)\n dir = File.expand_path(File.join(paths))\n dir = \"\" unless dir && File.directory?(dir)\n dir\nend",
"def setup_file\n self.setup_path \n end",
"def check_physical_product_file_exists\n f = File.expand_path('simple_store/lib/products/physical_product.rb', @work_dir)\n mark_file_exists(f)\n end"
] | [
"0.67858887",
"0.6622233",
"0.66025555",
"0.65714014",
"0.65709126",
"0.65055615",
"0.64921814",
"0.63616234",
"0.6309477",
"0.6296023",
"0.62916154",
"0.6271961",
"0.62543106",
"0.62440795",
"0.62233955",
"0.61894405",
"0.6183282",
"0.61554354",
"0.61161435",
"0.60941195",
"0.6092405",
"0.6056695",
"0.60564166",
"0.60537",
"0.6036914",
"0.6028284",
"0.59909475",
"0.59757066",
"0.596624",
"0.594802",
"0.59341013",
"0.59038234",
"0.59024423",
"0.5882597",
"0.5868619",
"0.58626103",
"0.5850257",
"0.5840525",
"0.5824627",
"0.5819787",
"0.5804678",
"0.5795383",
"0.5782884",
"0.57759154",
"0.5774081",
"0.5756113",
"0.5754359",
"0.5743562",
"0.57335734",
"0.5727138",
"0.5723538",
"0.5709404",
"0.5706744",
"0.5706568",
"0.57039195",
"0.56979567",
"0.56936705",
"0.56852734",
"0.5679776",
"0.56650096",
"0.56567144",
"0.56551224",
"0.5643046",
"0.5631139",
"0.5613797",
"0.5610677",
"0.56075233",
"0.5601483",
"0.5598328",
"0.55771613",
"0.5575179",
"0.55737305",
"0.5570612",
"0.556842",
"0.556677",
"0.55561256",
"0.5550971",
"0.55499774",
"0.5549381",
"0.55476713",
"0.55421156",
"0.55398977",
"0.55292296",
"0.5527348",
"0.5523702",
"0.55178976",
"0.55171704",
"0.5505321",
"0.5501107",
"0.54997975",
"0.5498108",
"0.5485514",
"0.54830736",
"0.54811716",
"0.5475588",
"0.5472162",
"0.5472162",
"0.5472162",
"0.54705334",
"0.5465789",
"0.5462258"
] | 0.0 | -1 |
GET /families GET /families.json | def index
@families = Family.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def index\r\n @families = Family.all\r\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'family list.'\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def show\n respond_to do |format|\n if current_user==nil\n render json: {error: 'No estas logeado'}, status: 401\n elsif @family==nil\n format.json { render json: {error: \"El familiar no existe\"}, status: :not_found }\n elsif current_user.families.include?(@family)==false\n format.json { render json: {error: 'No posees permisos para ver a esta persona'}, status: 401 }\n else\n format.json { render json: {family: @family, intolerances: @family.intolerances} }\n end\n format.html {}\n end\n end",
"def families\n @ks[:family].keys\n end",
"def index\n @families = current_church.families\n flash[:alert] = t('.not_found') if @families.blank?\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def index\n\t\t@families = Family.paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n\t\t\tformat.js # index.js.erb\n end\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n @species = Species.eager_load(:family, :species_locations, :images).order('families.name')\n respond_to do |format|\n format.html {\n not_found\n }\n format.xml { render :xml => @species }\n format.json {\n render :template => 'species/index.json'\n }\n end\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def index\n @os_families = OsFamily.all\n end",
"def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end",
"def show\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def index\n @language_families = LanguageFamily.all\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end",
"def families\n {}.tap { |ret|\n descriptor.families.each do |family|\n name = family.name_as_string\n ret[name] =\n parse_raw_map(family.values).tap { |props|\n COLUMN_PROPERTIES.each do |prop, gs|\n get = gs[:get]\n if get && family.respond_to?(get)\n props.delete(prop.to_s.upcase)\n props[prop] = parse_property family.send get\n end\n end\n }\n end\n }\n end",
"def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end",
"def list()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('devicefamily', 'list', 'KalturaDeviceFamilyListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def clusters\n begin\n clusters = PermissionsManager.get_family_clusters(current_user, clusters_params[:family_group_id])\n rescue\n render json: {}, status: 403\n return\n end\n render json: { 'clusters': clusters }, status: 200\n end",
"def index\n @product_families = ProductFamily.paginate(:page => params[:page], :order => \"name ASC\")\n @title = \"All Product Families\"\n end",
"def show\n @family ||= Family.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def getFamilyStatus\r\n\t\t@responseObject = OpenStruct.new({\r\n\t\t\tstatus: true,\r\n\t\t\terrors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n\t\t\tobjectData: FamilyGender.find(:all, :order => 'name DESC')\r\n\t\t})\r\n\t\trender :template => 'api/v1/users/members/familyStatus' ,:handlers => [:rabl],:formats => [:json]\r\n\tend",
"def index\n manage_filter_state\n letter = params[:letter]\n init_oco if !session[:organization]\n\n @search = ProductFamily.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !letter.blank? && letter != \"%\"\n with(:name).starting_with(letter)\n end\n order_by :family_code, :asc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @product_families = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_families }\n format.js\n end\n end",
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def raw_families\n {}.tap { |ret|\n descriptor.families.each do |family|\n name = family.name_as_string\n ret[name] = parse_raw_map family.values\n end\n }\n end",
"def family(id)\n Family.find(id)\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def index\n @students = Student.all(:order => \"family_name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def show\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_unit }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def show\n @guest = Guest.find(params[:id])\n respond_with(@guest) do |format|\n format.to_json { @guest.to_json(:include => [:party, :group]) }\n end\n end",
"def flavors()\n return get_request(address(\"/flavors/detail\"), @token)\t\n end",
"def index\n @prefix_groups = PrefixGroup.order(:group_name).includes(:prefixes).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prefix_groups }\n end\n end",
"def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def show\n @father = Father.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @father }\n end\n end",
"def visible_families\n # right now the count is the number of species\n TaxonName.find_by_sql(\n \"SELECT p.*, count(*) as count FROM \n (SELECT * FROM taxon_names t WHERE t.iczn_group = 'family' AND RIGHT(t.name,4) = 'idae') AS p\n LEFT JOIN \n (SELECT id, l, r FROM taxon_names t2 WHERE #{self.sql_for_taxon_names('t2', :public)} AND iczn_group = 'species') AS c \n ON p.l < c.l AND p.r > c.r\n WHERE c.id IS NOT NULL \n GROUP BY p.id ORDER BY name\") \n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end",
"def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"def index\n @reagent_groups = ReagentGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reagent_groups }\n end\n end",
"def show\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_blog }\n end\n end",
"def show\n if current_user.is_family_reporter? && (params[:id] != current_user.family_id.to_s)\n flash[:error] = \"You do not have permission to access this page.\"\n redirect_to home_path\n else\n @family = Family.find(params[:id], :include => [:users])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end\n end",
"def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end",
"def all_names\n @json_data['family_members'].collect { |user| user['name'] }\n end",
"def people\n Harvest::Resources::Person\n end",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end",
"def show\n begin\n @gender = Gender.find(params[:id]) \n\n render json: @gender, status: 200\n rescue ActiveRecord::RecordNotFound\n render json: {status: \"gender not found\"}, status: 404\n end\n end",
"def index\n @family_documents = FamilyDocument.all\n end",
"def set_family\n @family = Family.includes(members:[:contacts]).find(params[:id])\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def index\n @friends = Friend.all\n render json: @friends\n end",
"def family_id\n @gapi.family_id\n end",
"def index\n @admin_agencies = Admin::Agency.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_agencies }\n end\n end",
"def show\n camp_applications = current_family.application.camps\n render json: camp_applications.as_json\n end",
"def index\n @fundamental_guilds = Fundamental::Guild.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_guilds }\n end\n end",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end",
"def index\n respond_with Relationships.all\n end",
"def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def show\n @breadcrumb = 'read'\n @product_family = ProductFamily.find(params[:id])\n @products = @product_family.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n @stocks = @product_family.product_family_stocks.paginate(:page => params[:page], :per_page => per_page).order('store_id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_family }\n end\n end",
"def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end",
"def show\n @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def show\n render json: @family_image\n end",
"def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end",
"def list\n user = User.find_by_email params[:email]\n if user\n friendship = Friendship.where user: user\n render json: {success: true, friends: friendship.map {|f| f.friend.email}, count: friendship.count}\n else\n render json: {message: \"email not found\"}\n end\n end",
"def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n format.json { render json: @groups }\n end\n end",
"def index\n @fixtures = Fixture.all\n\n respond_to do |format|\n format.json { render json: @fixtures }\n end\n end",
"def index\n @groups = Group.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"def people\n @people = Person.find(:all, :order => 'family_name, given_name')\n\n respond_to do |format|\n format.html # people.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end"
] | [
"0.74112016",
"0.73993015",
"0.70999295",
"0.6936259",
"0.69057566",
"0.6888429",
"0.68346846",
"0.67850256",
"0.66525924",
"0.6604628",
"0.65405196",
"0.637672",
"0.6308998",
"0.62533224",
"0.6244051",
"0.62438947",
"0.6134215",
"0.60910314",
"0.6059278",
"0.6035607",
"0.60213447",
"0.60213447",
"0.59536016",
"0.5930202",
"0.5927338",
"0.5918963",
"0.58956933",
"0.5873879",
"0.5842441",
"0.58104944",
"0.5754076",
"0.57469654",
"0.5742001",
"0.5741829",
"0.5720377",
"0.57007545",
"0.5666038",
"0.56405777",
"0.5617768",
"0.5608604",
"0.5603078",
"0.5592432",
"0.5590486",
"0.55895305",
"0.5584295",
"0.5570654",
"0.5563394",
"0.5562474",
"0.5537646",
"0.5510616",
"0.54742855",
"0.5471611",
"0.54704696",
"0.54448193",
"0.5434573",
"0.54199904",
"0.5417238",
"0.541022",
"0.54006755",
"0.53977036",
"0.5397608",
"0.5390862",
"0.53904283",
"0.5379346",
"0.53663695",
"0.5351462",
"0.53450423",
"0.5334103",
"0.5334103",
"0.5330144",
"0.53280324",
"0.53228146",
"0.5313901",
"0.5312067",
"0.53098625",
"0.5300906",
"0.5272039",
"0.5267189",
"0.5260065",
"0.5259377",
"0.52518135",
"0.524612",
"0.524612",
"0.52456874",
"0.52455735",
"0.5243842",
"0.52431345",
"0.5239138",
"0.5230609",
"0.5226736",
"0.5226652",
"0.5226105",
"0.5223225",
"0.5222795",
"0.5222175",
"0.5219849",
"0.52174807",
"0.52130693"
] | 0.7089507 | 5 |
GET /families/1 GET /families/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\r\n @families = Family.all\r\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_member }\n end\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def show\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_history }\n end\n end",
"def show\n respond_to do |format|\n if current_user==nil\n render json: {error: 'No estas logeado'}, status: 401\n elsif @family==nil\n format.json { render json: {error: \"El familiar no existe\"}, status: :not_found }\n elsif current_user.families.include?(@family)==false\n format.json { render json: {error: 'No posees permisos para ver a esta persona'}, status: 401 }\n else\n format.json { render json: {family: @family, intolerances: @family.intolerances} }\n end\n format.html {}\n end\n end",
"def family(id)\n Family.find(id)\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def index\n @families = current_church.families\n flash[:alert] = t('.not_found') if @families.blank?\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def index\n @families = Family.find(:all, :select => \"id, business_name\", :order => \"business_name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n end\n end",
"def show\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @control_family }\n end\n end",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def show\n @family ||= Family.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @family_groups = FamilyGroup.all\n end",
"def show\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_unit }\n end\n end",
"def index\n @species = Species.eager_load(:family, :species_locations, :images).order('families.name')\n respond_to do |format|\n format.html {\n not_found\n }\n format.xml { render :xml => @species }\n format.json {\n render :template => 'species/index.json'\n }\n end\n end",
"def show\n @father = Father.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @father }\n end\n end",
"def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def index\n\t\t@families = Family.paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @families }\n\t\t\tformat.js # index.js.erb\n end\n end",
"def index\n @product_families = ProductFamily.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_families }\n end\n end",
"def family_id\n @gapi.family_id\n end",
"def show\n if current_user.is_family_reporter? && (params[:id] != current_user.family_id.to_s)\n flash[:error] = \"You do not have permission to access this page.\"\n redirect_to home_path\n else\n @family = Family.find(params[:id], :include => [:users])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end\n end",
"def show\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_blog }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def set_family\n @family = Family.includes(members:[:contacts]).find(params[:id])\n end",
"def families\n response = @client.get('plugins/families')\n verify response,\n forbidden: 'You do not have permission to view plugin families',\n internal_server_error: 'Server failed to retrieve the plugin '\\\n 'family list.'\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def index\n @os_families = OsFamily.all\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def families\n @ks[:family].keys\n end",
"def getFamilyStatus\r\n\t\t@responseObject = OpenStruct.new({\r\n\t\t\tstatus: true,\r\n\t\t\terrors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n\t\t\tobjectData: FamilyGender.find(:all, :order => 'name DESC')\r\n\t\t})\r\n\t\trender :template => 'api/v1/users/members/familyStatus' ,:handlers => [:rabl],:formats => [:json]\r\n\tend",
"def show\n @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family_background }\n end\n end",
"def index\n @product_families = ProductFamily.paginate(:page => params[:page], :order => \"name ASC\")\n @title = \"All Product Families\"\n end",
"def show\n begin\n @gender = Gender.find(params[:id]) \n\n render json: @gender, status: 200\n rescue ActiveRecord::RecordNotFound\n render json: {status: \"gender not found\"}, status: 404\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.friendly.find(params[:id])\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def set_family\n @family = Family.find_by_id(params[:id])\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n @language_families = LanguageFamily.all\n end",
"def family_by_name(name)\n Family.find_by_name(name)\n end",
"def show\n @manifestation_relationship_type = ManifestationRelationshipType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manifestation_relationship_type }\n end\n end",
"def show\n render json: @family_image\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relationships }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end",
"def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end",
"def show\n @gene_name = GeneName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gene_name }\n end\n end",
"def show\n @guest = Guest.find(params[:id])\n respond_with(@guest) do |format|\n format.to_json { @guest.to_json(:include => [:party, :group]) }\n end\n end",
"def index\n @family_documents = FamilyDocument.all\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @vendor_relationship = VendorRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor_relationship }\n end\n end",
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def show\n @family_id = @user.fam_id\n\t@login = @user.login\n\t@family = Fam.find(:all, :conditions => [\"id=?\", @family_id])\n #@calendar = @user.calendars.find(params[:id])\n\t@calendar = @family[0].users[0].calendars.find(params[:id])\n\t#@family = @calendar.families\n\t#@family = Family.find(:all, :conditions => [\"id=?\", \"1\"])\n\t@user = User.find(:all, :conditions => [\"id=?\", @calendar.user_id])\n\t@family = User.find(:all, :conditions => [\"fam_id=?\", @user[0].fam_id])\n\t@fam = Fam.find(:all)\n\t#@help = @fam[0].users[0].id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def show\r\n @family = Family.find params[:id]\r\n @members = @family.members\r\n @member = @family.members.new\r\n @image = @family.images.new\r\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def show\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_family }\n end\n end",
"def show\n \n \n @people= Person.findByNameOrId(params[:id])\n \n if (@people.length == 1) \n @person = @people[0]\n else \n if(@people.length > 1)\n @name = params[:id].capitalize\n disambiguation\n return\n end\n end \n \n if(!@person)\n redirect_to '/search?q=' +params[:id].is_a?(Numeric) #+ params[:id].to_s + '&page=1'\n return\n end\n \n @max_depth = params[:family_tree_depth] || 3 \n @max_depth = @max_depth.to_i\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def show\n @relationship = Relationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relationship }\n end\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def show\n @gene_group = GeneGroup.find(params[:id], :include => :genes)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_group }\n format.text { render :text => @gene_group.json_query.to_s}\n end\n end",
"def show\n @breadcrumb = 'read'\n @product_family = ProductFamily.find(params[:id])\n @products = @product_family.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n @stocks = @product_family.product_family_stocks.paginate(:page => params[:page], :per_page => per_page).order('store_id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_family }\n end\n end",
"def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end",
"def new\n @family_history = FamilyHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_history }\n end\n end",
"def show\n @lookup = Lookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lookup }\n end\n end",
"def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end",
"def index\n manage_filter_state\n letter = params[:letter]\n init_oco if !session[:organization]\n\n @search = ProductFamily.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !letter.blank? && letter != \"%\"\n with(:name).starting_with(letter)\n end\n order_by :family_code, :asc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @product_families = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_families }\n format.js\n end\n end",
"def index\n id = params[:id].to_i\n\n if id != 0\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find_all_by_id(id)\n if @agencies.any?\n @agency_name = @agencies.first.name\n end\n else\n \t @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find(:all)\n end\n\n\t\t@records_returned = @agencies.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @agencies }\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end",
"def show\n @agent_group = AgentGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agent_group }\n end\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end"
] | [
"0.73359054",
"0.724417",
"0.7214146",
"0.7206399",
"0.7167201",
"0.7093841",
"0.7093841",
"0.7093841",
"0.6945207",
"0.6817828",
"0.67575496",
"0.66471833",
"0.6474473",
"0.6474473",
"0.6456767",
"0.64294004",
"0.6424024",
"0.63775104",
"0.626056",
"0.62563133",
"0.6234184",
"0.6186986",
"0.6183666",
"0.6178271",
"0.61641186",
"0.61553055",
"0.61334395",
"0.60600513",
"0.5971597",
"0.5935568",
"0.58857447",
"0.5884183",
"0.587683",
"0.5870795",
"0.5844919",
"0.5816631",
"0.5805454",
"0.5775911",
"0.57465434",
"0.5737673",
"0.57340986",
"0.5730747",
"0.57249695",
"0.5722594",
"0.56821984",
"0.56821984",
"0.567015",
"0.5648324",
"0.5630754",
"0.5620887",
"0.56125045",
"0.5602812",
"0.5602812",
"0.55994785",
"0.5596875",
"0.55962926",
"0.5555596",
"0.5553813",
"0.5551644",
"0.5551644",
"0.5531614",
"0.5510836",
"0.5508105",
"0.5504328",
"0.5487145",
"0.54860693",
"0.54842347",
"0.54808444",
"0.5474797",
"0.54736614",
"0.5473062",
"0.5472402",
"0.546749",
"0.5462119",
"0.54576176",
"0.5455312",
"0.5452324",
"0.5451599",
"0.5451052",
"0.5447288",
"0.5437677",
"0.5430006",
"0.5424767",
"0.541916",
"0.54173255",
"0.5414663",
"0.5412988",
"0.54123354",
"0.54031485",
"0.53758913",
"0.5370959",
"0.53676915",
"0.5361566",
"0.5361309",
"0.53612053",
"0.5358786",
"0.53563076",
"0.5356239",
"0.535598",
"0.5353579",
"0.5353541"
] | 0.0 | -1 |
POST /families POST /families.json | def create
@family = Family.new(family_params)
if session[:type_user]=="Miembro"
@family.comunity = current_user.profile.member.comunity
end
respond_to do |format|
if @family.save
format.html { redirect_to @family, notice: 'La familia fue creada exitosamente.' }
format.json { render :show, status: :created, location: @family }
else
format.html { render :new }
format.json { render json: @family.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_jobfamily\n @jobfamily = @company.jobfamilies.create(name: params[:jobfamily][:name])\n respond_to do |format|\n format.json { render json: @jobfamily }\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n family_params\n f = params[:family]\n @family = Family.new\n @family.name = f[:name]\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @family }\n else\n format.html { render action: 'new' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:family][:user_id] = current_user.id if params[:family][:user_id]==nil\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n @family = Family.new(family_params)\n # if current_user.families.count == 0\n # current_user.username = @family.name\n # current_user.save\n # end\n\n respond_to do |format|\n if @family.save\n format.json { render json: {created: @family} }\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :new }\n end\n end\n end",
"def create\n p params\n family = Family.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n # save the information from user input to create a new family.\n family.save!\n if family.save!\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def create\n @family_relationship = FamilyRelationship.new(family_relationship_params)\n\n respond_to do |format|\n if @family_relationship.save\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully created.' }\n format.json { render :show, status: :created, location: @family_relationship }\n else\n format.html { render :new }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def create\n @sub_family = SubFamily.new(sub_family_params)\n\n respond_to do |format|\n if @sub_family.save\n format.html { redirect_to @sub_family, notice: 'Sub familia foi criada.' }\n format.json { render :show, status: :created, location: @sub_family }\n else\n format.html { render :new }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_family = OsFamily.new(os_family_params)\n\n respond_to do |format|\n if @os_family.save\n format.html { redirect_to @os_family, notice: 'Os family was successfully created.' }\n format.json { render :show, status: :created, location: @os_family }\n else\n format.html { render :new }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :created, :location => @control_family }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :status)\n end",
"def create\n puts :family\n @family = FamilyDecorator.decorate(Family.new(params[:family]))\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params[:family].permit(:name)\n end",
"def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name)\n end",
"def create\n @family = Family.new(params[:family])\n respond_to do |format|\n if @family.save\n flash[:notice] = 'Family was successfully created.'\n format.html { redirect_to(@family) }\n format.xml { render :xml => @family, :status => :created, :location => @family }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\r\n params.require(:family).permit(:name)\r\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"def family_params\n params.require(:family).permit(:name, :user_id)\n end",
"def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render :show, status: :created, location: @family_member }\n else\n format.html { render :new }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @farmer_family = @farmer.farmer_families.build(farmer_family_params)\n\n respond_to do |format|\n if @farmer_family.save\n SystemLog.create(description: \"Cadastraou uma novo membro da família para o agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia adicionado com sucesso' }\n format.json { render :show, status: :created, location: @farmer_family }\n else\n format.html { render :new }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_relationship_params\n params.require(:family_relationship).permit(:code, :name)\n end",
"def create\n @family = Family.new(params[:family])\n if User.find_by_email(session[:user_email]).identity >= 3 #if user is at least manager+\n @family.approved_by = User.find_by_email(session[:user_email]).id\n @family.display = true\n end\n respond_to do |format|\n if @family.save\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n flash[:error] = \"Sorry, one or more fields were not entered correctly. Please double-check that the information is correct.\"\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(family_member_params)\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to @family_member, notice: 'Family member was successfully created.' }\n format.json { render json: @family_member, status: :created, location: @family_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_family = LanguageFamily.new(language_family_params)\n\n respond_to do |format|\n if @language_family.save\n format.html { redirect_to @language_family, notice: 'Language family was successfully created.' }\n format.json { render action: 'show', status: :created, location: @language_family }\n else\n format.html { render action: 'new' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new\n [:father, :mother].each do |p|\n pp = params[p].keep_if { |k,v| !v.blank? }\n\n @family.__send__ \"#{p}=\", (pp.blank? ? nil : get_user_from_params(pp))\n end\n\n respond_to do |format|\n if @family.save\n uninitialized_pw = User.initialize_without_password(\"\").password_digest\n [@family.father, @family.mother].select { |p| p }.each { |p|\n user_is_new = p.user.password_digest == uninitialized_pw\n EasyRailsAuthentication::AuthenticationHelper.SendPasswordInitializationEmailTo p.email if user_is_new\n }\n format.html { redirect_to (added_user_info? ? family_url(@family.id) : families_url), notice: 'Family was successfully created.' }\n format.json { render json: @family, status: :created, location: @family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\r\n @families = Family.all\r\n end",
"def create\n @family_bond = FamilyBond.new(family_bond_params)\n\n respond_to do |format|\n if @family_bond.save\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully created.' }\n format.json { render :show, status: :created, location: @family_bond }\n else\n format.html { render :new }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:home_address, :email_address, :phone_number, primary_family_member_attributes: %i[type first_name last_name age])\n end",
"def create\n @family_document = FamilyDocument.new(family_document_params)\n\n respond_to do |format|\n if @family_document.save\n format.html { redirect_to @family_document, notice: \"Family document was successfully created.\" }\n format.json { render :show, status: :created, location: @family_document }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def create\n @family_crest = FamilyCrest.new(params[:family_crest])\n\n respond_to do |format|\n if @family_crest.save\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully created.' }\n format.json { render json: @family_crest, status: :created, location: @family_crest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.find(params[:participant][:family]) rescue nil\n params[:participant][:family] = @family\n @participants = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participants.save\n AuditTrail.audit(\"Participant #{@participants.fullname} created by #{current_user.login}\", edit_participant_url(@participants))\n flash[:notice] = 'Participants was successfully created.'\n format.html { params[:commit] == 'Save' ? redirect_to(participants_path) : redirect_to(new_participant_path) }\n format.xml { render :xml => @participants, :status => :created, :location => @participants }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participants.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @family_image = FamilyImage.new(family_image_params)\n\n if @family_image.save\n render json: @family_image, status: :created, location: @family_image\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def sub_family_params\n params.require(:sub_family).permit(:name, :created_at, :updated_at)\n end",
"def create\n @rental = Rental.find(params[:rental_id])\n @tenant_family_member = TenantFamilyMember.new(tenant_family_member_params)\n @tenant_family_member.rental = @rental\n\n respond_to do |format|\n if @tenant_family_member.save\n format.html { redirect_to @rental, notice: 'Tenant family member was successfully created.' }\n format.json { render :show, status: :created, location: @tenant_family_member }\n else\n format.html { render :new }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_member = FamilyMember.new(params[:family_member])\n @family_member.family = @current_family\n\n respond_to do |format|\n if @family_member.save\n format.html { redirect_to(family_family_member_url(@current_family, @family_member), :notice => 'A Family Member was successfully created.') }\n format.xml { render :xml => @family_member, :status => :created, :location => @family_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:nombre_casa, :numero_casa, :telefono, :comunity_id,:direccion)\n end",
"def create\n @father = Father.new(params[:father])\n\n respond_to do |format|\n if @father.save\n format.html { redirect_to @father, notice: 'Father was successfully created.' }\n format.json { render json: @father, status: :created, location: @father }\n else\n format.html { render action: \"new\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def create\n @family_unit = FamilyUnit.new(params[:family_unit])\n\n respond_to do |format|\n if @family_unit.save\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully created.' }\n format.json { render json: @family_unit, status: :created, location: @family_unit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @farmer_families = @farmer.farmer_families\n end",
"def create\n @admin_father = Admin::Father.new(admin_father_params)\n\n respond_to do |format|\n if @admin_father.save\n format.html { redirect_to @admin_father, notice: 'Father was successfully created.' }\n format.json { render :show, status: :created, location: @admin_father }\n else\n format.html { render :new }\n format.json { render json: @admin_father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_family = ProductFamily.new(params[:product_family])\n \n if @product_family.save\n flash[:success] = 'Product family was successfully created.'\n redirect_to(product_families_path)\n else\n @title = \"New Product Family\"\n render :action => \"new\" \n end\n end",
"def add_family!(family_name)\n self.family = Family.where(name: family_name).first_or_create! \n self.save!\n end",
"def create\n @breadcrumb = 'create'\n @product_family = ProductFamily.new(params[:product_family])\n @product_family.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.save\n format.html { redirect_to @product_family, notice: crud_notice('created', @product_family) }\n format.json { render json: @product_family, status: :created, location: @product_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @habit = Habit.new(habit_params)\n @habit.source = params[:for_family].to_i == 1 ? current_family : current_user\n\n respond_to do |format|\n if @habit.save\n format.html { redirect_to habit_path(@habit), notice: '習慣データを作成しました.' }\n format.json { render json: @habit, status: :created, location: @habit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @habit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @family_history = FamilyHistory.new(family_history_params)\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully created.' }\n format.json { render :show, status: :created, location: @family_history }\n else\n format.html { render :new }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\trespond_with Species.create(species_params)\n\tend",
"def create\n @forest = Forest.new(params[:forest])\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render json: @forest, status: :created, location: @forest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def create\n @family = Family.new(family_params)\n @family.church = current_church\n\n if @family.save\n flash[:notice] = t('.success', name: @family.name)\n redirect_to action: :index\n else\n render :new\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def create\n group_ids = params[\"group_id\"]\n org_id = params[:organization_id]\n @user = User.new(full_name: params[:full_name], password: params[:password], password_confirmation: params[:password], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path], team_leader_id: nil)\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sub_families = SubFamily.all\n end",
"def new\n if request.post?\n\n @last_name = params[:last_name]\n @first_name = params[:first_name]\n @login = params[:login]\n @email = params[:email]\n @business_name = params[:business_name]\n @mailing_address = params[:mailing_address]\n @city = params[:city]\n @state = params[:state]\n @zip_code = params[:zip_code]\n @phone_number = params[:phone_number]\n @num_users = params[:num_users]\n @num_generations = params[:num_generations]\n\n begin\n Family.transaction do\n family_reporter = FamilyReporter.new(:last_name => params[:last_name], :first_name => params[:first_name],\n :login => params[:login], :email => params[:email], :password => params[:password], :password_confirmation => params[:password_confirmation])\n family = Family.new(:business_name => @business_name, :mailing_address => @mailing_address, :city => @city, :state => @state, :zip_code => @zip_code, :phone_number => @phone_number, :num_users => @num_users, :num_generations => @num_generations)\n\n family_reporter.family = family\n family_reporter.save!\n family_reporter.register!\n family.save!\n end\n\n flash[:notice] = \"New family for #{@business_name} added!\"\n redirect_to :action => :index\n rescue Exception => e\n flash[:error] = \"Error #{e.message}\"\n end\n end\n end",
"def family_group_params\n params.require(:family_group).permit(:family_name, :family_description)\n end",
"def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end",
"def create\n @forest = Forest.new(forest_params)\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forest }\n else\n format.html { render action: 'new' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @srg = Srg.find(params[:srg_id])\n @srg_control = @srg.srg_controls.new(get_srg_control_hash(params))\n get_nist_families.each do |nist_params|\n @srg_control.nist_familys.create(nist_params)\n end\n\n respond_to do |format|\n if @srg_control.save\n format.html { redirect_to @srg_control, notice: 'Srg control was successfully created.' }\n format.json { render :show, status: :created, location: @srg_control }\n else\n format.html { render :new }\n format.json { render json: @srg_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family_background = FamilyBackground.new(params[:family_background])\n\n respond_to do |format|\n if @family_background.save\n format.html { redirect_to(@family_background, :notice => 'Family background was successfully created.') }\n format.xml { render :xml => @family_background, :status => :created, :location => @family_background }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @family_background.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :description, :position, :country_id, categories_attributes: [:id, :name, :description, :position, :_destroy])\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def index\n @family_relationships = FamilyRelationship.all\n end",
"def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end",
"def farmer_family_params\n params.require(:farmer_family).permit(:name, :cpf, :farmer_id, :gender, :birthday)\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def additional_family_member_params\n params.require(:additional_family_member).permit(:first_name, :last_name, :age, :working, :family_id, :relationship_id, :type)\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end",
"def create\n $lovedone = nil\n @family_member = User.new(family_member_params)\n @family_member.profile.user_type = Profile.user_types[:family_member]\n respond_to do |format|\n if @family_member.save\n unless family_member_params_for_lovedone[:lovedones].blank?\n follower = Follower.new user_id: @family_member.id, request_status: \"invited\", \n lovedone_id: family_member_params_for_lovedone[:lovedones]\n follower.save\n end\n @family_member.send_on_create_confirmation_instructions_ex\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully created.' }\n #format.json { render :show, status: :created, location: @family_member }\n else\n if current_user.admin?\n @lovedones = Lovedone.all\n else\n @lovedones = current_user.lovedones\n end\n format.html { render :new }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end",
"def create\n @tracing_couple_family = TracingCoupleFamily.new(tracing_couple_family_params)\n\n\n respond_to do |format|\n if @tracing_couple_family.save\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully created.' }\n format.json { render :show, status: :created, location: @tracing_couple_family }\n else\n format.html { render :new }\n format.json { render json: @tracing_couple_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def create\n @user=User.find(params[:user_id])\n @follower = @user.followers.create(follower_params)\n if @follower.save\n render json: @follower, status: :created\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end",
"def list_families\n http_get(:uri=>\"/plugins/families\", :fields=>x_cookie)\n end",
"def create\n @family_history = FamilyHistory.new(params[:family_history])\n\n respond_to do |format|\n if @family_history.save\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully created.' }\n format.json { render json: @family_history, status: :created, location: @family_history }\n else\n format.html { render action: PersonalDetail.find(@family_history.personal_detail_id) }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_family(fam, propagate = true)\n count = 0\n if leaf?\n [fam].flatten.each do |f|\n if product_families.where([\"product_family_id = ?\", f.id]).empty?\n product_families << f\n count += 1\n end\n end\n else\n errors.add(:base, \"Can't add product family to non-leaf category.\")\n end\n if (count > 0) && propagate\n propagate_families_up\n generate_attributes_up\n end\n count\n end",
"def create\n @family_blog = FamilyBlog.new(params[:family_blog])\n\n respond_to do |format|\n if @family_blog.save\n @person = Person.find_by_id(@family_blog.person_id)\n format.html { redirect_to @person, notice: 'Family blog was successfully created.' }\n format.json { render json: @family_blog, status: :created, location: @family_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @family_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def send_female_room_allocation(employees)\n allocated_female_fellows = employees.select do |employee|\n employee.sex == \"F\" && employee.room != nil\n end\n\n response = {}\n if allocated_female_fellows\n data = get_fellows_room_allocation(allocated_female_fellows)\n response[\"message\"] = \"These female fellows have been allocated to available rooms!\"\n response[\"total\"] = data.length\n response[\"data\"] = data\n json = response.to_json\n female_room_allocation = File.new(\"allocations/female_room_allocation.json\", \"w\")\n female_room_allocation.puts json\n female_room_allocation.close\n puts \"Please check the file 'allocations/female_room_allocation.json' to view all female room allocations!\"\n else\n response[\"message\"] = \"No female fellow has been allocated to a room!\"\n json = response.to_json\n female_room_allocation = File.new(\"allocations/female_room_allocation.json\", \"w\")\n female_room_allocation.puts json\n female_room_allocation.close\n puts \"No female has been allocated to a room! You may view the file 'allocations/female_room_allocation.json'\"\n end\n end"
] | [
"0.69394344",
"0.6557405",
"0.6539632",
"0.62348044",
"0.6194535",
"0.6145975",
"0.6061082",
"0.60608697",
"0.6032527",
"0.5941302",
"0.5921364",
"0.5920388",
"0.5912198",
"0.5904324",
"0.58811975",
"0.5864885",
"0.5859784",
"0.5856368",
"0.5819247",
"0.580773",
"0.580773",
"0.580773",
"0.5786938",
"0.5713424",
"0.57104576",
"0.5684626",
"0.56792676",
"0.56755316",
"0.567173",
"0.567167",
"0.5647437",
"0.56226146",
"0.5613363",
"0.55733556",
"0.5491835",
"0.5460287",
"0.5405056",
"0.5362649",
"0.53580475",
"0.5353537",
"0.53245133",
"0.5316403",
"0.5314467",
"0.5304071",
"0.5301617",
"0.5291802",
"0.5284492",
"0.52716094",
"0.52675897",
"0.5250687",
"0.5246036",
"0.523764",
"0.5234957",
"0.522205",
"0.5221165",
"0.5218057",
"0.5212764",
"0.5196357",
"0.5191438",
"0.518819",
"0.518819",
"0.51854384",
"0.518539",
"0.5171017",
"0.51649964",
"0.51640856",
"0.5158974",
"0.5158974",
"0.5157994",
"0.51561403",
"0.5147449",
"0.5140159",
"0.5139202",
"0.5117788",
"0.51175785",
"0.5115685",
"0.5111836",
"0.5110793",
"0.51090664",
"0.50999147",
"0.50999147",
"0.5094635",
"0.5088126",
"0.5083299",
"0.5077929",
"0.50687414",
"0.50551975",
"0.5052848",
"0.50420606",
"0.50400007",
"0.5034926",
"0.5025185",
"0.5011969",
"0.5006895",
"0.50024486",
"0.499888",
"0.4992779",
"0.4984844",
"0.49799317",
"0.49736157",
"0.49730924"
] | 0.0 | -1 |
PATCH/PUT /families/1 PATCH/PUT /families/1.json | def update
respond_to do |format|
@family.slug=nil
if @family.update(family_params)
format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }
format.json { render :show, status: :ok, location: @family }
else
format.html { render :edit }
format.json { render json: @family.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end",
"def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @family.update(family_params)\r\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @family }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n addMembers\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family = Family.find(params[:id])\n\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = \"Family #{@family.business_name} was successfully updated.\"\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @family = Family.find(params[:id])\n @user = User.find_by_email(session[:user_email])\n if @user && @user.identity == 2\n\[email protected]_by = nil\n end\n respond_to do |format|\n if @family.update_attributes(params[:family])\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@family ||= Family.find(params[:id])\n respond_to do |format|\n if @family.update_attributes(params[:family])\n flash[:notice] = 'Family was successfully updated.'\n format.html { redirect_to(@family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_relationship.update(family_relationship_params)\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_relationship }\n else\n format.html { render :edit }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub_family.update(sub_family_params)\n format.html { redirect_to @sub_family, notice: 'Sub família foi atualizada.' }\n format.json { render :show, status: :ok, location: @sub_family }\n else\n format.html { render :edit }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_group.update(family_group_params)\n format.html { redirect_to @family_group, notice: 'Family group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @control_family = ControlFamily.find(params[:id])\n\n respond_to do |format|\n if @control_family.update_attributes(params[:control_family])\n format.html { redirect_to @control_family, :notice => 'Control family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @control_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_family.update(os_family_params)\n format.html { redirect_to @os_family, notice: 'Os family was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_family }\n else\n format.html { render :edit }\n format.json { render json: @os_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_document.update(family_document_params)\n format.html { redirect_to @family_document, notice: \"Family document was successfully updated.\" }\n format.json { render :show, status: :ok, location: @family_document }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @family_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tenant_family_member.update(tenant_family_member_params)\n format.html { redirect_to @tenant_family_member, notice: 'Tenant family member was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant_family_member }\n else\n format.html { render :edit }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(family_member_params)\n format.html { redirect_to @family_member, notice: 'Family member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n if @family_crest.update_attributes(params[:family_crest])\n format.html { redirect_to @family_crest, notice: 'Family crest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_crest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @product_family = ProductFamily.find(params[:id])\n @product_family.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n format.html { redirect_to @product_family,\n notice: (crud_notice('updated', @product_family) + \"#{undo_link(@product_family)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @language_family.update(language_family_params)\n format.html { redirect_to @language_family, notice: 'Language family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @language_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @family_name_spec = args[:family_name_spec] if args.key?(:family_name_spec)\n @given_name_spec = args[:given_name_spec] if args.key?(:given_name_spec)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @father = Father.find(params[:id])\n\n respond_to do |format|\n if @father.update_attributes(params[:father])\n format.html { redirect_to @father, notice: 'Father was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tracing_couple_family.update(tracing_couple_family_params)\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully updated.' }\n format.json { render :show, status: :ok, location: @tracing_couple_family }\n else\n format.html { render :edit }\n format.json { render json: @tracing_couple_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def update\n @family_unit = FamilyUnit.find(params[:id])\n\n respond_to do |format|\n if @family_unit.update_attributes(params[:family_unit])\n format.html { redirect_to @family_unit, notice: 'Family unit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def update\n @family_history = FamilyHistory.find(params[:id])\n\n respond_to do |format|\n if @family_history.update_attributes(params[:family_history])\n format.html { redirect_to PersonalDetail.find(@family_history.personal_detail_id), notice: 'Family history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_history.update(family_history_params)\n format.html { redirect_to patient_path(@family_history.patient), notice: 'Family history was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_history }\n else\n format.html { render :edit }\n format.json { render json: @family_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @farmer_family.update(farmer_family_params)\n SystemLog.create(description: \"Atualizou as informações do membro da família do agricultor #{@farmer.name}(#{@farmer.farmer_code}) chamado #{@farmer_family.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @farmer_family.farmer, @farmer_family], notice: 'Integrante da familia atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @farmer_family }\n else\n format.html { render :edit }\n format.json { render json: @farmer_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_background = FamilyBackground.find(params[:id])\n\n respond_to do |format|\n if @family_background.update_attributes(params[:family_background])\n format.html { redirect_to(@family_background, :notice => 'Family background was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family_background.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_family\r\n @family = Family.find(params[:id])\r\n end",
"def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def set_family\n @family = Family.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @admin_father.update(admin_father_params)\n format.html { redirect_to @admin_father, notice: 'Father was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_father }\n else\n format.html { render :edit }\n format.json { render json: @admin_father.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_member = FamilyMember.find(params[:id])\n\n respond_to do |format|\n if @family_member.update_attributes(params[:family_member])\n format.html { redirect_to(family_family_member_url(@current_family, @family_member), :notice => 'A Family Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @family_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n group_ids = params[:group_id]\n org_id = params[:organization_id]\n @user = User.find_by_id(params[:user_id])\n current_group_ids = @user.user_group_ids\n\n respond_to do |format|\n if @user.update_attributes(full_name: params[:full_name], abbreviation: params[:abbreviation], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path])\n\n is_logged = [email protected]_changes.blank?\n if current_group_ids != group_ids\n @user.user_group_ids = group_ids\n format.json { render json: @user }\n end\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_family = ProductFamily.find(params[:id])\n\n respond_to do |format|\n if @product_family.update_attributes(params[:product_family])\n flash[:notice] = 'Família de produtos atualizada.'\n format.html { redirect_to(@product_family) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_family.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.find(params[:family_id])\n end",
"def update!(**args)\n @family_name = args[:family_name] if args.key?(:family_name)\n @given_name = args[:given_name] if args.key?(:given_name)\n end",
"def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end",
"def family_params\n params.require(:family).permit(:name, :status)\n end",
"def update\n @product_family = ProductFamily.find(params[:id])\n\n if @product_family.update_attributes(params[:product_family])\n flash[:success] = 'Product family was successfully updated.'\n redirect_to(product_families_path) \n else\n @title = \"Edit Product Family\"\n render :action => \"edit\"\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taxon_name_relationship.update(taxon_name_relationship_params)\n format.html { redirect_to @taxon_name_relationship.metamorphosize, notice: 'Taxon name relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @taxon_name_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_family\n @family = Family.find_by_id(params[:id])\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def update\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n if @card_font_family.update_attributes(params[:card_font_family])\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @manifestation_relationship_type = ManifestationRelationshipType.find(params[:id])\n\n respond_to do |format|\n if @manifestation_relationship_type.update_attributes(params[:manifestation_relationship_type])\n format.html { redirect_to @manifestation_relationship_type, notice: 'Manifestation relationship type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manifestation_relationship_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def update\n @groupaddrobj = Groupaddrobj.find(params[:id])\n\n respond_to do |format|\n if @groupaddrobj.update_attributes(params[:groupaddrobj])\n format.html { redirect_to @groupaddrobj, notice: 'Groupaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @groupaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with []\n end",
"def update\n @conferencerm = Conferencerm.find(params[:id])\n\n respond_to do |format|\n if @conferencerm.update_attributes(params[:conferencerm])\n format.html { redirect_to @conferencerm, notice: 'Conferencerm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conferencerm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end",
"def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @group_request.update(group_request_params)\n format.html { redirect_to @group_request, notice: 'Group request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asagroupservobj = Asagroupservobj.find(params[:id])\n\n respond_to do |format|\n if @asagroupservobj.update_attributes(params[:asagroupservobj])\n format.html { redirect_to @asagroupservobj, notice: 'Asagroupservobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asagroupservobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n @organization_person = OrganizationPerson.find(params[:id])\n\n if @organization_person.update(organization_person_params)\n render json: @organization_person\n else\n render json: @organization_person.errors, status: :unprocessable_entity\n end\n end",
"def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agency.update(agency_params)\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foreign_key.update(foreign_key_params)\n format.html { redirect_to @foreign_key, notice: 'Foreign key was successfully updated.' }\n format.json { render :show, status: :ok, location: @foreign_key }\n else\n format.html { render :edit }\n format.json { render json: @foreign_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def update\n @admin_agency = Admin::Agency.find(params[:id])\n\n respond_to do |format|\n if @admin_agency.update_attributes(params[:admin_agency])\n format.html { redirect_to @admin_agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @foster_parent.update(foster_parent_params)\n format.html { redirect_to @foster_parent, notice: 'Foster parent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foster_parent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @family_name = args[:family_name] if args.key?(:family_name)\n @full_name = args[:full_name] if args.key?(:full_name)\n @given_name = args[:given_name] if args.key?(:given_name)\n end",
"def patch(path, **args); end",
"def update!(**args)\n @people = args[:people] if args.key?(:people)\n end",
"def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6766356",
"0.6752083",
"0.67093277",
"0.6607182",
"0.65421635",
"0.6374736",
"0.6369962",
"0.63593566",
"0.63144934",
"0.63023",
"0.62908006",
"0.62390554",
"0.6202691",
"0.61117816",
"0.6012359",
"0.59905547",
"0.5990456",
"0.59778",
"0.5957144",
"0.5915357",
"0.59107053",
"0.59052926",
"0.5852345",
"0.5800832",
"0.57906806",
"0.57825476",
"0.5777811",
"0.5773599",
"0.5746221",
"0.5726221",
"0.570549",
"0.5689257",
"0.56833947",
"0.56833947",
"0.56713814",
"0.56669885",
"0.5644928",
"0.5632963",
"0.5631184",
"0.562279",
"0.56180656",
"0.56168866",
"0.5611117",
"0.5607287",
"0.55922395",
"0.55922395",
"0.55859107",
"0.5572791",
"0.5572642",
"0.5556685",
"0.5555009",
"0.55527484",
"0.5545276",
"0.5543495",
"0.5540751",
"0.5539662",
"0.5536302",
"0.5533673",
"0.55212414",
"0.5512014",
"0.5511875",
"0.5510455",
"0.5506826",
"0.55010146",
"0.5499119",
"0.549871",
"0.5480935",
"0.54765743",
"0.547077",
"0.54556584",
"0.5455492",
"0.54483354",
"0.54480225",
"0.54324186",
"0.543033",
"0.54282326",
"0.5418839",
"0.54166114",
"0.5415134",
"0.54113835",
"0.540982",
"0.54057443",
"0.54045844",
"0.5401943",
"0.5395601",
"0.53944194",
"0.53934294",
"0.5391814",
"0.53863037",
"0.5385859",
"0.5385386",
"0.53851956",
"0.53815895",
"0.5375378",
"0.53742737",
"0.5372156",
"0.5370267",
"0.53697354",
"0.5366601",
"0.5366297"
] | 0.6303013 | 9 |
DELETE /families/1 DELETE /families/1.json | def destroy
@family.destroy
respond_to do |format|
format.html { redirect_to families_url, notice: 'La familia fue eliminada exitosamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family.destroy\n respond_to do |format|\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @family.destroy\r\n respond_to do |format|\r\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @family = Family.find(params[:id])\n @family.destroy\n\n respond_to do |format|\n format.html { redirect_to session[:redirect_path] }\n format.json { head :ok }\n end\n end",
"def destroy\n @os_family.destroy\n respond_to do |format|\n format.html { redirect_to os_families_url, notice: 'Os family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @family = Family.find(params[:id])\n# @family.destroy\n#\n# respond_to do |format|\n# format.html { redirect_to(families_url) }\n# format.xml { head :ok }\n# end\n end",
"def destroy\n @control_family = ControlFamily.find(params[:id])\n @control_family.destroy\n\n respond_to do |format|\n format.html { redirect_to control_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_group.destroy\n respond_to do |format|\n format.html { redirect_to family_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_relationship.destroy\n respond_to do |format|\n format.html { redirect_to family_relationships_url, notice: 'Family relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if current_user.families.include?(@family)\n @family.destroy\n format.json { render json: {destroyed: \"Familiar '#{@family.name}' eliminado correctamente\"}, status: :ok }\n else\n format.json { render json: {error: \"No posees los permisos para eliminar a esta persona\", families: current_user.families}, status: 401 }\n # format.json { head :no_content }\n end\n format.html { redirect_to families_url, notice: 'Family was successfully destroyed.' }\n end\n end",
"def destroy\n family = @child.family\n @child.destroy\n respond_to do |format|\n format.html { redirect_to family, notice: tr(\"child_deleted\") }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to family_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_bond.destroy\n respond_to do |format|\n format.html { redirect_to family_bonds_url, notice: 'Family bond was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family.destroy\n redirect_to families_url, notice: 'Family was successfully destroyed.'\n end",
"def destroy\n @tenant_family_member.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Tenant family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n genus = Genu.all;\n genus.each do |genu|\n if(genu.sub_family_id == @sub_family.id)\n genu.destroy\n end\n end\n @sub_family.destroy\n respond_to do |format|\n format.html { redirect_to sub_families_url, notice: 'Sub família foi deletada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @language_family.destroy\n respond_to do |format|\n format.html { redirect_to language_families_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @family_member.destroy\n respond_to do |format|\n format.html { redirect_to family_members_url, notice: 'Family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_crest = FamilyCrest.find(params[:id])\n @family_crest.destroy\n\n respond_to do |format|\n format.html { redirect_to family_crests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_history = FamilyHistory.find(params[:id])\n @family_history.destroy\n\n respond_to do |format|\n format.html { redirect_to family_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firend_relationship.destroy\n respond_to do |format|\n format.html { redirect_to user_firend_relationships_url, notice: 'Firend relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_unit = FamilyUnit.find(params[:id])\n @family_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to family_units_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_father.destroy\n respond_to do |format|\n format.html { redirect_to admin_fathers_url, notice: 'Father was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foreign_key.destroy\n respond_to do |format|\n format.html { redirect_to foreign_keys_url, notice: 'Foreign key was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_history.destroy\n respond_to do |format|\n format.html { redirect_to family_histories_url, notice: 'Family history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_member = User.find(params[:id])\n @family_member.destroy\n respond_to do |format|\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @family_background = FamilyBackground.find(params[:id])\n @family_background.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_backgrounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent_relationship_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_relationship_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.agent_relationship_type')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_family_members_url(@current_family)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_document.destroy\n respond_to do |format|\n format.html { redirect_to family_documents_url, notice: \"Family document was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n Family.find(params[:id]).destroy\n \n respond_to do |format|\n format.js { render nothing: true }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_family = ProductFamily.find(params[:id])\n @product_family.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_families_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @ghb.destroy\n respond_to do |format|\n format.html { redirect_to ethers_url, notice: 'Ether was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groups_happening = GroupsHappening.find(params[:id])\n @groups_happening.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_happenings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def delete_from_family family_name\n options = { family_name: family_name }\n @mutations <<\n Google::Bigtable::V2::Mutation.new(delete_from_family: options)\n end",
"def destroy\n @tracing_couple_family.destroy\n respond_to do |format|\n format.html { redirect_to clinic_history_couple_tracing_couple_families_path(@clinic_history_couple.id), notice: 'Tracing couple family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manifestation_relationship_type = ManifestationRelationshipType.find(params[:id])\n @manifestation_relationship_type.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestation_relationship_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reagent_group = ReagentGroup.find(params[:id])\n @reagent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end",
"def destroy\n @gid2name = Gid2name.find(params[:id])\n @gid2name.destroy\n\n respond_to do |format|\n format.html { redirect_to gid2names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tx_land_grants_efn.destroy\n respond_to do |format|\n format.html { redirect_to tx_land_grants_efns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n @child_guardian_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to child_guardian_relationships_url }\n format.json { head :no_content }\n end\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n @agent_group = AgentGroup.find(params[:id])\n @agent_group.destroy\n\n respond_to do |format|\n format.html { redirect_to agent_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @who_prefix = WhoPrefix.find(params[:id])\n @who_prefix.destroy\n\n respond_to do |format|\n format.html { redirect_to(who_prefixes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy\n @healthrecord = Healthrecord.find(params[:id])\n @healthrecord.destroy\n\n respond_to do |format|\n format.html { redirect_to indexhealthrecord_path(current_member) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_hospitalization_type = Ref::HospitalizationType.find(params[:id])\n @ref_hospitalization_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_hospitalization_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @agent = @business.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to business_agents_url(@business) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frais_hebergement = FraisHebergement.find(params[:id])\n @frais_hebergement.destroy\n\n respond_to do |format|\n format.html { redirect_to frais_hebergements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registering_agency.destroy\n respond_to do |format|\n format.html { redirect_to registering_agencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_heal.destroy\n respond_to do |format|\n format.html { redirect_to manage_heals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agency_type = AgencyType.find(params[:id])\n @agency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupon = Groupon.find(params[:id])\n @groupon.destroy\n\n respond_to do |format|\n format.html { redirect_to groupons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @healthpro.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beacon = Beacon.find(params[:id])\n @beacon.destroy\n\n respond_to do |format|\n format.html { redirect_to beacons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gene_name = GeneName.find(params[:id])\n @gene_name.destroy\n\n respond_to do |format|\n format.html { redirect_to gene_names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @herald.destroy\n respond_to do |format|\n format.html { redirect_to heralds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fakemodel.destroy\n respond_to do |format|\n format.html { redirect_to fakemodels_url, notice: 'Fakemodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @npc_relation.destroy\n respond_to do |format|\n format.html { redirect_to npc_relations_url, notice: 'Npc relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suburb_master.destroy\n respond_to do |format|\n format.html { redirect_to suburb_masters_url, notice: 'Suburb master was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @multi_agent_service.destroy\n respond_to do |format|\n format.html { redirect_to multi_agent_services_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_subtype = EntitySubtype.find(params[:id])\n @entity_subtype.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_subtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.html { redirect_to fixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.html { redirect_to fixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_group.destroy\n respond_to do |format|\n format.html { redirect_to food_groups_url, notice: 'Food group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7309996",
"0.73002434",
"0.7138071",
"0.7109038",
"0.70249385",
"0.7000798",
"0.69814944",
"0.69413674",
"0.67451394",
"0.6730755",
"0.6714874",
"0.6634114",
"0.66101265",
"0.6605488",
"0.6605488",
"0.66020864",
"0.6600027",
"0.65869814",
"0.65752846",
"0.6566904",
"0.65668076",
"0.6496911",
"0.6489133",
"0.6470982",
"0.6426334",
"0.63993037",
"0.63881046",
"0.63557076",
"0.6355323",
"0.6351327",
"0.63507193",
"0.6349367",
"0.6348159",
"0.6345175",
"0.6337297",
"0.6326131",
"0.6325857",
"0.629808",
"0.6296875",
"0.62920785",
"0.6282367",
"0.6253655",
"0.62425524",
"0.62417966",
"0.6241773",
"0.6217309",
"0.62103164",
"0.6209466",
"0.61828786",
"0.6177219",
"0.6173894",
"0.6173622",
"0.6172028",
"0.6170461",
"0.61580825",
"0.6156166",
"0.6148349",
"0.61431944",
"0.6141964",
"0.61348665",
"0.6126672",
"0.6120562",
"0.6117329",
"0.6105981",
"0.61000556",
"0.60966194",
"0.60939455",
"0.60930586",
"0.6089199",
"0.60883224",
"0.60836136",
"0.60825795",
"0.60807383",
"0.60802424",
"0.6073482",
"0.60714453",
"0.6069774",
"0.6068349",
"0.6066028",
"0.60643774",
"0.6058923",
"0.60557157",
"0.6054353",
"0.60542864",
"0.605301",
"0.6051965",
"0.6048644",
"0.60475457",
"0.6046701",
"0.60452527",
"0.6045089",
"0.60449225",
"0.60406727",
"0.6038656",
"0.6037328",
"0.6036398",
"0.6029774",
"0.60273516",
"0.60273516",
"0.6025182"
] | 0.7022638 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_family
@family = Family.friendly.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def family_params
params.require(:family).permit(:nombre_casa, :numero_casa, :telefono, :comunity_id,:direccion)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
There's no obviously easy way to get NArray to mul_accum on a slice without making a temporary object. So we make them all and store them in a regular Ruby array. | def preslice_filter filter
slices = []
steps = filter.shape[0] / 2
steps.times do |i|
f_start = steps-i
f_end = -1-i
if filter.rank == 2
slices << filter[f_start..f_end, true]
else
slices << filter[f_start..f_end]
end
end
slices
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_total_with_reduce_2(array)\n array.map.with_index do |el, idx|\n array[0..idx].reduce(:+)\n end\nend",
"def reduction(new_array)\n arr = []\n new_array.each do |x|\n arr << x.reduce(:+)\n end\n return arr\n end",
"def parts_sums(input_array)\n total = input_array.sum\n output = [total]\n input_array.size.times do \n total = total - input_array.shift\n output << total\n end\n output\nend",
"def long_subarrays(arr)\n res =[]\n window = arr.length\n while window>=1\n idx = 0\n while idx+window<=arr.length\n sub_arr = arr.slice(idx, window)\n p sub_arr\n res << sub_arr\n idx += 1\n end\n window -= 1\n end\n res.map{|el| el.inject(0){|acc, el2| acc+el2}}.sort.last\nend",
"def gather(n=0)\n array = []\n sum = 0\n (0...n).each do |i|\n sum += i\n array << sum\n end\n return array\n end",
"def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total << element.inject(:+)\n index += 1\n end\n run_total\nend",
"def custom_multiply(array, number)\n count = 0\n final =[]\n while count < number\n final = array + final\n count +=1\n end\n final\nend",
"def running_total_3 arr\n sum = 0\n arr.each_with_object([]) do |elm, obj|\n sum += elm\n obj << sum\n end\nend",
"def prefix_sums(arr)\n arr_size = arr.size\n p_arr = Array.new(arr_size, 0)\n p_arr[0] = arr[0]\n\n (1...arr.size).each do |k|\n p_arr[k] = p_arr[k - 1] + arr[k]\n end\n\n p_arr\nend",
"def sumSlice(values, id, sliceSize)\r\n start = id * sliceSize\r\n stop = start + sliceSize - 1\r\n myTotal = 0\r\n for i in start..stop\r\n myTotal += values[i]\r\n end\r\n myTotal\r\nend",
"def running_total(arr)\n tot = []\n arr.size.times do |i|\n tot << arr[0..i].reduce(&:+)\n end\n tot\nend",
"def mutateTheArray(n, a)\n prv = 0\n (0...a.size).each do |i|\n nxt = i < (a.size - 1) ? a[i+1] : 0\n tmp = a[i]\n a[i] += nxt + prv\n prv = tmp\n end\n a\nend",
"def sum_of_sums(arr)\n new_arr = []\n \n arr.each_with_index do |num, idx|\n new_arr << arr[0..idx].reduce(:+)\n end\n \n p new_arr.reduce(:+)\nend",
"def reduce_to_total(source_array, starting_point = 0)\n \n source_array.sum + starting_point\n \nend",
"def custom_multiply(array,number)\n new_array = []\n number.times {new_array+=array}\n return new_array\nend",
"def get_other_products(nums)\n nums_copy = nums.dup\n other_products = Array.new(nums.length)\n\n nums.each_with_index do | num, curr_idx |\n nums_copy.delete_at(curr_idx)\n other_products[curr_idx] = nums_copy.reduce(:*)\n nums_copy = nums.dup\n end\n return other_products\nend",
"def sum_sub_arrays_from_index(arr, index)\n for i in (index..arr.count)\n sub_array = arr.slice(index, i)\n $sub_array_hash[sub_array] = sub_array.reduce(0) {|sum, x| sum + x}\n end\nend",
"def array_product_bruteforce(a)\r\n\tprod = Array.new(a.size)\r\n\ti = 0\r\n\r\n\twhile i < a.size\r\n\t\tc = a[0..a.size]\r\n\t\tc.delete_at(i)\r\n\t\tprod[i] = c.inject(:*)\r\n\t\ti += 1\r\n\tend\r\n\treturn prod\r\nend",
"def running_total(array)\n new_array = []\n i = 0\n while i <= array.length - 1\n new_array << array[0..i].reduce(:+)\n i += 1\n end\n new_array\nend",
"def multiply_arrnums_by_index(numbers) # array of ints\n new_array = [] # empty array\n i = 0 # start at indice 0\n while i < numbers.length\n new_array << numbers[i] * i # shovel value of int val of the indice * the indice\n # numb_to_mult = numbers[i]\n # numb_multd = numbers[i] * numb_to_mult\n # new_array << numb_multd\n i += 1 # next iteration\n end\n return new_array\nend",
"def running_total(array)\n sum = 0\n array.each_with_object([]) do |el, new_array|\n new_array << sum += el\n end\nend",
"def chunk(array, slice)\n sliced_array = []\n array.each_slice(slice) do |num|\n sliced_array.push(num)\n end\n p sliced_array\nend",
"def array_subsets(arr)\n return [[]] if arr.empty?\n partial_subset = array_subsets(arr[0..-2])\n addition = partial_subset.map {|ele| ele + [arr[-1]]}\n partial_subset + addition\nend",
"def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n elements = 1\n while elements - 1 < arr.size\n total_sum += arr.slice(idx, elements).reduce(:+)\n elements += 1\n end\n total_sum\nend",
"def running_total2(array)\n total = 0\n array.each_with_object([]) do |num, arr|\n total += num\n arr << total\n end\nend",
"def running_total(array)\n sum = 0\n\n array.each_with_object([]) do |number, new_array|\n new_array << sum += number\n end\nend",
"def running_total(array)\n result = []\n array.each_index do |i|\n result[i] = (0..i).to_a.map { |e| array[e] }.inject(:+)\n end\n result\nend",
"def running_total(input_array)\n sum = 0 # => 0, 0, 0, 0\n new_array = input_array.map do |value| # => [2, 5, 13], [14, 11, 7, 15, 20], [3], []\n sum += value # => 2, 7, 20, 14, 25, 32, 47, 67, 3\n end # => [2, 7, 20], [14, 25, 32, 47, 67], [3], []\nend",
"def mutiply_all_element_of_an_array_excep_itself2(array_n)\n total_mutiplication_value = 1\n result_array = []\n \n array_n.each do |elm|\n total_mutiplication_value = elm * total_mutiplication_value\n end\n \n puts \"Total mutiplication : #{total_mutiplication_value}\"\n \n array_n.each do |elm|\n result = divide_by_bit_shift(total_mutiplication_value, elm)\n result_array.push(result[0])\n end\n \n\n return result_array\nend",
"def running_total1(array)\n r_total = 0\n array.map { |n| r_total += n }\nend",
"def running_total(array)\r\n new_arr = []\r\n total = 0\r\n array.map do |x|\r\n total += x\r\n new_arr << total\r\n end\r\n new_arr\r\n end",
"def reduce(array, acc = 0)\n index = 0\n\n while index < array.size\n acc = yield(acc, array[index])\n index += 1\n end\n\n acc\nend",
"def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend",
"def matrix_addition_reloaded(*arr)\n return nil if !arr.all? { |x| arr[0].length == x.length }\n sum = arr[0]\n 1.upto(arr.length - 1).each do |i|\n sum = matrix_addition(sum, arr[i])\n end\n sum\nend",
"def reduce(arr, accum=0)\n counter = 0\n\n while counter < arr.size\n accum = yield(accum, arr[counter])\n counter += 1\n end\n\n accum\nend",
"def running_total(array)\n # new_array = []\n sum = 0\n array.inject([]) do |arr, val| \n sum += val\n arr << sum \n arr\n end\nend",
"def reduce(arr,acc)\n # for each element in the array, run the block, called by yield, with the accumulator and the current element, then set the new value of accelerator (acc) to the result of that round of the block being run.\n arr.each { |x| acc = yield(acc,x) }\n # return the final value of the accumulator\n acc\nend",
"def array_sum_with_index(arr)\n acc = 0\n arr.each_with_index {|int, id| acc += (int * id)}\n acc\nend",
"def reduce(arr, acc = 0)\n count = 0\n\n while count < arr.size\n acc = yield(acc, arr[count])\n count += 1\n end\n\n acc\nend",
"def reduce_to_total(source_array, starting_point = 0)\n total = starting_point\n index = 0\n while index < source_array.size do\n total += source_array[index]\n index += 1\n end\n total\nend",
"def reduce_to_total(source_array, starting_point = 0)\n #source_array.reduce(starting_point) {|sum, n| sum + n}\n i = 0\n sum = starting_point\n while i < source_array.length do\n sum = sum + source_array[i]\n i += 1\n end\n return sum\nend",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend",
"def reduce(arr, acc=0)\n sum = acc\n counter = 0\n\n while counter < arr.size\n element = arr[counter]\n sum = yield(sum, element)\n counter += 1\n end\n\n sum\nend",
"def cut_off_array_with_sum(array, cut_off)\n # +1 to hold sum of rest\n a = Array.new(cut_off+1){|i| array[i]||0}\n # add rest of array to last elem\n a[cut_off] += array.inject(:+) - a.inject(:+)\n return a\n end",
"def running_total(input_arr)\n total = 0\n input_arr.map do |current_element|\n total += current_element\n end\nend",
"def contiguous_sub_array_sum(array, target)\n sum = 0\n last_value = array.first\n n = array.length\n (1..(n - 1)).each do |i|\n \n end\nend",
"def sum_of_sums(array)\n new_array = []\n array.size.times do |n|\n new_array << array[0..n]\n end\n new_array.flatten.reduce(:+)\nend",
"def naive_parts_sums(ls)\n out_array = []\n while ls.length > 0\n current_sum = ls.sum\n out_array << current_sum\n ls.shift\n end\n out_array << 0\n return out_array\nend",
"def running_total(array)\n total = 0\n new_array = []\n while array.size > 0\n total += array.shift\n new_array << total\n end\n new_array\nend",
"def accumulate(array)\n cumulative = 0\n array.map { |value| cumulative += value }\n end",
"def running_total(array)\n array.map.with_index { |e, i| array[0..i].reduce(:+) }\nend",
"def reduce(array, initial_acc=0)\n accumulator = initial_acc\n\n for elem in array do\n accumulator = yield(accumulator, elem)\n end\n\n accumulator\nend",
"def reduce(arr,acc)\n each arr do |x|\n acc = yield(acc,x)\n end\n acc \nend",
"def partial_sums(array)\n new_list = [0]\n array.each_with_index do |num, i|\n new_list.push(num + new_list[0 + i])\n end\n return new_list\nend",
"def sumInParallel(values, numThreads)\r\n sliceSize = values.size / numThreads\r\n threadArray = Array.new( numThreads )\r\n result = 0\r\n lock = Mutex.new\r\n\r\n (1..numThreads-1).each do | i |\r\n threadArray[i] = Thread.new { \r\n myTotal = sumSlice(values, \r\n i,\r\n sliceSize) \r\n lock.synchronize {\r\n result += myTotal\r\n }\r\n }\r\n end\r\n\r\n myTotal = sumSlice(values, 0, sliceSize)\r\n\r\n leftovers = values.size % numThreads\r\n if leftovers > 0\r\n for i in values.size-leftovers..values.size-1\r\n myTotal += values[i]\r\n end\r\n end\r\n\r\n lock.synchronize {\r\n result += myTotal\r\n }\r\n\r\n for i in 1..numThreads-1\r\n threadArray[i].join\r\n end\r\n\r\n result\r\nend",
"def running_total(array)\n result = []\n sum = 0\n index = 0\n\n while array.size > index\n result << sum += array[index]\n index += 1\n end\n result\nend",
"def multi_map(arr, n = 1, &prc)\n new_arr = arr\n n.times do\n new_arr = new_arr.map {|ele| ele = prc.call(ele)}\n end\n new_arr\nend",
"def running_total3(array)\n sum = 0\n array.map do |num|\n sum = [sum, num].inject(:+)\n end\nend",
"def _reduce_216(val, _values, result)\n result = []\n\n result\nend",
"def multi_map(arr, n=1, &prc)\n new_arr = []\n\n arr.each do |ele|\n new_ele = ele\n n.times do\n new_ele = prc.call(new_ele)\n end\n\n new_arr << new_ele\n end\n new_arr\n\nend",
"def arraysum\n return self.inject(0){|acc,i|acc +i}\n end",
"def reduce_to_total(source_array, starting_point = 0)\n new_sum = source_array.reduce(starting_point, :+)\n return new_sum\nend",
"def running_total(input_arr)\n running_total_arr = []\n input_arr.each_with_index do |elem, idx|\n if idx == 0\n running_total_arr[idx] = input_arr[idx]\n p running_total_arr\n else\n running_total_arr[idx] = running_total_arr[idx - 1] + input_arr[idx]\n p running_total_arr\n end\n end\n return running_total_arr\nend",
"def running_total arr\n totals = []\n sum = 0\n arr.each do |elm|\n sum += elm\n totals << sum\n end\n totals\nend",
"def reduce_to_total(source_array, starting_point=0)\n temp = starting_point\n i = 0\n while i < source_array.length do\n temp += source_array[i]\n i += 1\n end\n return temp\nend",
"def test_lexical_union_array\n lex_array = (1..100).map do |i|\n if i % 2 == 0\n i\n else\n i.to_f + 100.0\n end\n end\n\n partial_sums = PArray.new(100) do |j|\n result = 0.0\n\n for i in 0...j\n result = result + lex_array[i]\n end\n\n result\n end\n\n assert_in_delta(416650.0, partial_sums.to_a.reduce(:+), 0.1)\n end",
"def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = @length.times.collect do\n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end",
"def ary_add(array)\n if array.length.even?\n ary_couples = array.each_slice(2)\n final_ary = []\n ary_couples.each do |duo|\n ary_sum = duo[0] + duo[-1]\n final_ary << ary_sum \n end\n return final_ary\n else\n last_obj = array.pop\n ary_couples = array.each_slice(2)\n final_ary = []\n ary_couples.each do |duo|\n ary_sum = duo[0] + duo[-1]\n final_ary << ary_sum \n \n end\n return final_ary << last_obj\n end \nend",
"def reduce_to_total(source_array, starting_point=0)\n i = 0\n total = starting_point\n while i < source_array.length do\n total = total + source_array[i]\n i += 1\n end\n total\nend",
"def generic_sub_array_with_sum(arr, sum)\n sum_array = Array.new(arr.size+1) { Array.new(sum+1) } \n sub_array(arr, 0, sum, sum_array)\nend",
"def running_total1(array)\n array_new = []\n loop do\n break if array.empty?\n array_new << array[0]\n array[1] = array[0] + array[1] if array.size >= 2\n array.shift\n end\n array_new\nend",
"def my_function2(arr)\n final_arr = []\n first_half = []\n first_product = 1\n last_half = []\n arr.each_with_index do |n, i|\n first_half = arr[0...i]\n last_half = arr[i+1..-1]\n first_product = first_half.reduce(:*) || 1\n last_product = last_half.reduce(:*) || 1\n products = first_product * last_product\n final_arr.push(products)\n end\n return \"Products: #{final_arr}\"\nend",
"def map(array)\n new = []\n i = 0\n \n while i < array.length do\n \n # yield passes each element to the block\n new.push(yield(array[i]))\n # push the element into the new array\n \n i += 1\n \n # Each method call with a block will do the actual calculations\n \n end\n new\nend",
"def process_group\n slice_size = 0.step(@ids.size - 1, @process_group_chunk).size\n\n @ids.each_slice(slice_size).lazy\n # => [[1, 2, 3, ...], [10, 11, 12, ...], ...]\n end",
"def reduce(arr, start = arr.first)\n counter = 1\n accumulator = start\n while counter < arr.size\n accumulator = yield(accumulator, arr[counter])\n counter += 1\n end\n accumulator += arr.first if start != arr.first\n accumulator\nend",
"def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend",
"def partialSums(arr)\n sums = [0]\n arr.inject(0) do |memo,x|\n sums.push(memo+x)\n memo+x\n end\n sums\nend",
"def reduce_to_total(source_array, starting_point = 0 )\n \n new_total = starting_point\n i = 0\n while i < source_array.length do\n new_total += source_array[i]\n i += 1\n end\n return new_total\n \n end",
"def running_total(array)\n result = []\n count = 0\n total = 0\n\n while count < array.size\n total += array[count]\n result << total\n count += 1\n end\n result\nend",
"def a_very_big_sum arr\n arr.reduce(:+)\n end",
"def cross_array(*enumerables)\n # return to_a.product(*enumerables.map{|e| e.to_a})\n enumerables.unshift self\n result = [[]]\n while !enumerables.empty?\n t, result = result, []\n b, *enumerables = enumerables\n t.each do |a|\n b.each do |n|\n result << a + [n]\n end\n end\n end\n result\n end",
"def reduce(arr, accum = 0)\n arr.each do |element|\n accum = yield(accum, element)\n end\n accum\nend",
"def reduce arr, val\n output = val\n arr.each do |n|\n output = yield(output, n)\n end\n output\nend",
"def perm(arr)\n return [arr] if arr.length <= 1\n result = []\n arr.each_index do |idx|\n temp = perm(arr[0...idx] + arr[idx+1..-1])\n subset = temp.map { |sub| [arr[idx]] + sub }\n result += subset\n end\n\n result\n\n\n\n\n # return [arr] if arr.length <= 1\n # result = []\n #\n # arr.each_index do |idx|\n #\n # other_perm = perm(arr[0...idx] + arr[idx+1..-1])\n # row = other_perm.map { |subarr| [arr[idx]] + subarr }\n # result += row\n # end\n #\n # result\nend",
"def partial_sums(arr)\n sums = [0]\n arr.inject(0) do |memo,x|\n sums.push(memo+x)\n memo+x\n end\n sums\nend",
"def _reduce_468(val, _values, result)\n result = [val[0]]\n \n result\nend",
"def large_contig_subsum1(arr)\n timestart = Time.now\n sub_arrs = []\n\n\n arr.each_with_index do |el, idx|\n\n count = 0\n while idx+count < arr.length\n sub_arrs << arr[idx..idx+count]\n count+=1\n end\n end\n\n\n sum_arr = []\n sub_arrs.each do | sub_arr |\n sum_arr << sub_arr.reduce(:+)\n end\n\n max = sum_arr.max\n p (Time.now - timestart) * 1000\n max\nend",
"def combined_array(multid_array)\n new_array = Array.new(multid_array.first.count) { |x| Array.new }\n\n multid_array.each do |array|\n array.each_index do |index|\n new_array[index] = new_array[index] + array[index]\n end\n end\n\n return new_array\n end",
"def array_sum_by_index(arr)\n\nend",
"def sub_arrays(arr)\n sub_arr = []\n i_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sub_arr << i_arr\n end\n i_arr = []\n arr.shift\n end\n sub_arr\nend",
"def running_total(array)\n p array.each_with_index { |_, index| array[0..index].reduce(:+) }\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def sum arr\n arr.inject(0,:+)\nend",
"def reduce(source_array, starting_point = nil)\n if starting_point\n total = starting_point\n index = 0\n else\n total = source_array[0]\n index = 1\n end\n \n while index < source_array.length do\n total = yield(total, source_array[index])\n\t index += 1\n end\n total\nend",
"def get_products_of_all_ints_except_at_index(array)\n result_array = []\n array.each do |num|\n working_array = array.dup\n working_array.delete(num)\n product = working_array.reduce {|sum, num| sum * num}\n result_array << product\n end\n\n return result_array\nend",
"def products_except_me(numbers)\n\n result = []\n numbers.each_index do |i|\n subarr = numbers[0...i] + numbers[i+1..-1]\n result << subarr.reduce(:*)\n\n end\n result\nend",
"def products_except_me(numbers)\n numbers.map.with_index do |num, idx|\n sub_arr = numbers[0...idx] + numbers[idx + 1..-1]\n sub_arr.reduce(:*)\n end\nend",
"def _reduce_2(val, _values, result)\n result.append val[1]\n result\nend",
"def running_total_2(array)\n total = 0\n array.map do |x|\n total += x\n end\nend",
"def running_total(old_array)\n counter = 0\n new_array = []\n loop do \n break if counter >= old_array.length\n if counter == 0\n new_array[counter] = old_array[counter]\n else \n new_array[counter] = old_array[counter] + new_array[counter-1]\n end\n counter += 1\n end\n new_array\nend"
] | [
"0.6123777",
"0.60949636",
"0.59567857",
"0.58957595",
"0.5883685",
"0.5866686",
"0.5840751",
"0.58107334",
"0.5785157",
"0.57754123",
"0.5772103",
"0.57472354",
"0.57442343",
"0.57363856",
"0.57333004",
"0.56877446",
"0.56826687",
"0.56798124",
"0.5676726",
"0.5662563",
"0.56429833",
"0.56368464",
"0.56318283",
"0.5630971",
"0.5604342",
"0.5601589",
"0.5594907",
"0.559212",
"0.5589086",
"0.5576568",
"0.5562298",
"0.5547343",
"0.55347264",
"0.5531528",
"0.5526441",
"0.55238444",
"0.55177355",
"0.5500755",
"0.54947835",
"0.5494621",
"0.5487124",
"0.54768145",
"0.5472685",
"0.5472612",
"0.54650176",
"0.5461547",
"0.5461131",
"0.5460125",
"0.5456904",
"0.5449387",
"0.54369855",
"0.54368174",
"0.54366964",
"0.5434127",
"0.5434087",
"0.54307175",
"0.54198414",
"0.54101664",
"0.54091084",
"0.5406056",
"0.5405093",
"0.5402086",
"0.5397527",
"0.5387044",
"0.5384905",
"0.5382448",
"0.5379749",
"0.5379615",
"0.5379017",
"0.5374106",
"0.5370508",
"0.5366737",
"0.5365725",
"0.53578436",
"0.5350652",
"0.53472114",
"0.53440934",
"0.53357667",
"0.5334259",
"0.5333608",
"0.5331872",
"0.5331372",
"0.5330966",
"0.53255576",
"0.53253764",
"0.5322076",
"0.5318793",
"0.53174853",
"0.5311233",
"0.53045136",
"0.52997655",
"0.5298344",
"0.52933055",
"0.52933055",
"0.52928966",
"0.5292242",
"0.5291322",
"0.52861655",
"0.5284267",
"0.5283849",
"0.527869"
] | 0.0 | -1 |
We build filters with two copies of data so a circular buffer can mul_accum on a slice. | def double_filter coef
coef = coef.to_a
if Complex === coef[0]
new_coef = NArray.scomplex coef.size * 2
else
new_coef = NArray.sfloat coef.size * 2
end
# reverse into position
new_coef[coef.size-1..0] = coef
new_coef[-1..coef.size] = coef
new_coef
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_filters(filters, op)\n filters = filters.compact\n if filters.length == 0\n nil\n elsif filters.length == 1\n filters.first\n else\n {op => filters}\n end\n end",
"def reduce_blocks(blks, filter = writable_mifare_blocks)\n if identify_2d_array(blks)\n hsh = blks.to_h\n filter.map { |x| hsh[x] }.compact.flatten\n else\n filter.map { |x| blks[x] }.compact.flatten\n end\n end",
"def combine(other, conn=:and)\n return other.clone if self.empty?\n\n if other.empty?\n return self.clone\n elsif self.filters[0].member?(conn)\n f = self.clone\n f.filters[0][conn] += other.filters\n elsif other.filters[0].member?(conn)\n f = other.clone\n f.filters[0][conn] += self.filters\n else\n f = initialize(self.clone.filters + other.filters, conn)\n end\n\n return f\n end",
"def preslice_filter filter\n slices = []\n steps = filter.shape[0] / 2\n steps.times do |i|\n f_start = steps-i\n f_end = -1-i\n if filter.rank == 2\n slices << filter[f_start..f_end, true]\n else\n slices << filter[f_start..f_end]\n end\n end\n slices\n end",
"def collect data\n i = 0\n data_size = data.size\n while i < data_size\n remaining = data_size - i\n space = @bins - @fft_pos\n actual = [remaining,space].min\n new_fft_pos = @fft_pos + actual\n @fft[@fft_pos...new_fft_pos] = data[i...i+actual]\n @fft_pos = new_fft_pos\n if @fft_pos == @bins\n @fft_pos = 0\n @next_fft = @fft.dup\n end\n i += actual\n end\n end",
"def remaining_filters\n filters[@processed..-1]\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def bench_filters\n skip 'TODO'\n end",
"def store_autofilter(index, operator_1, token_1, #:nodoc:\n join = nil, operator_2 = nil, token_2 = nil)\n record = 0x009E\n length = 0x0000\n\n top10_active = 0\n top10_direction = 0\n top10_percent = 0\n top10_value = 101\n\n grbit = join || 0\n optimised_1 = 0\n optimised_2 = 0\n doper_1 = ''\n doper_2 = ''\n string_1 = ''\n string_2 = ''\n\n # Excel used an optimisation in the case of a simple equality.\n optimised_1 = 1 if operator_1 == 2\n optimised_2 = 1 if !operator_2.nil? and operator_2 == 2\n\n # Convert non-simple equalities back to type 2. See _parse_filter_tokens().\n operator_1 = 2 if operator_1 == 22\n operator_2 = 2 if !operator_2.nil? and operator_2 == 22\n\n # Handle a \"Top\" style expression.\n if operator_1 >= 30\n # Remove the second expression if present.\n operator_2 = nil\n token_2 = nil\n\n # Set the active flag.\n top10_active = 1\n\n if (operator_1 == 30 or operator_1 == 31)\n top10_direction = 1\n end\n\n if (operator_1 == 31 or operator_1 == 33)\n top10_percent = 1\n end\n\n if (top10_direction == 1)\n operator_1 = 6\n else\n operator_1 = 3\n end\n\n top10_value = token_1.to_i\n token_1 = 0\n end\n\n grbit |= optimised_1 << 2\n grbit |= optimised_2 << 3\n grbit |= top10_active << 4\n grbit |= top10_direction << 5\n grbit |= top10_percent << 6\n grbit |= top10_value << 7\n\n doper_1, string_1 = pack_doper(operator_1, token_1)\n doper_2, string_2 = pack_doper(operator_2, token_2)\n\n doper_1 = '' if doper_1.nil?\n doper_2 = '' if doper_2.nil?\n string_1 = '' if string_1.nil?\n string_2 = '' if string_2.nil?\n\n data = [index].pack('v')\n data = data + [grbit].pack('v')\n data = data + doper_1 + doper_2 + string_1 + string_2\n\n length = data.length\n header = [record, length].pack('vv')\n\n prepend(header, data)\n end",
"def filters\n fail Error, \"Nothing to roll...\" unless @reels\n fail Error, \"Supporting just full_screen for now, sorry.\" unless @reels.all?(&:full_screen?)\n return @filters if @filters\n\n idx = process.output_index(self)\n\n @filters = []\n\n # Concatting\n segments = []\n\n @reels.each_with_index do |curr_reel, i|\n\n lbl = nil\n\n if curr_reel.reel\n\n # NOTE mapping input to this lbl\n\n lbl = \"o#{idx}rl#{i}\"\n\n # NOTE Image-Padding to match the target resolution\n # TODO full screen only at the moment (see exception above)\n\n Ffmprb.logger.debug \"#{self} asking for filters of #{curr_reel.reel.io.inspect} video: #{channel(:video)}, audio: #{channel(:audio)}\"\n @filters.concat(\n curr_reel.reel.filters_for lbl, video: channel(:video), audio: channel(:audio)\n )\n end\n\n trim_prev_at = curr_reel.after || (curr_reel.transition && 0)\n transition_length = curr_reel.transition ? curr_reel.transition.length : 0\n\n if trim_prev_at\n\n # NOTE make sure previous reel rolls _long_ enough AND then _just_ enough\n\n prev_lbl = segments.pop\n\n lbl_pad = \"bl#{prev_lbl}#{i}\"\n # NOTE generously padding the previous segment to support for all the cases\n @filters.concat(\n Filter.blank_source trim_prev_at + transition_length,\n channel(:video).resolution, channel(:video).fps, \"#{lbl_pad}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.silent_source trim_prev_at + transition_length, \"#{lbl_pad}:a\"\n ) if channel?(:audio)\n\n if prev_lbl\n lbl_aux = lbl_pad\n lbl_pad = \"pd#{prev_lbl}#{i}\"\n @filters.concat(\n Filter.concat_v [\"#{prev_lbl}:v\", \"#{lbl_aux}:v\"], \"#{lbl_pad}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.concat_a [\"#{prev_lbl}:a\", \"#{lbl_aux}:a\"], \"#{lbl_pad}:a\"\n ) if channel?(:audio)\n end\n\n if curr_reel.transition\n\n # NOTE Split the previous segment for transition\n\n if trim_prev_at > 0\n @filters.concat(\n Filter.split \"#{lbl_pad}:v\", [\"#{lbl_pad}a:v\", \"#{lbl_pad}b:v\"]\n ) if channel?(:video)\n @filters.concat(\n Filter.asplit \"#{lbl_pad}:a\", [\"#{lbl_pad}a:a\", \"#{lbl_pad}b:a\"]\n ) if channel?(:audio)\n lbl_pad, lbl_pad_ = \"#{lbl_pad}a\", \"#{lbl_pad}b\"\n else\n lbl_pad, lbl_pad_ = nil, lbl_pad\n end\n end\n\n if lbl_pad\n\n # NOTE Trim the previous segment finally\n\n new_prev_lbl = \"tm#{prev_lbl}#{i}a\"\n\n @filters.concat(\n Filter.trim 0, trim_prev_at, \"#{lbl_pad}:v\", \"#{new_prev_lbl}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.atrim 0, trim_prev_at, \"#{lbl_pad}:a\", \"#{new_prev_lbl}:a\"\n ) if channel?(:audio)\n\n segments << new_prev_lbl\n Ffmprb.logger.debug \"Concatting segments: #{new_prev_lbl} pushed\"\n end\n\n if curr_reel.transition\n\n # NOTE snip the end of the previous segment and combine with this reel\n\n lbl_end1 = \"o#{idx}tm#{i}b\"\n lbl_reel = \"o#{idx}tn#{i}\"\n\n if !lbl # no reel\n lbl_aux = \"o#{idx}bk#{i}\"\n @filters.concat(\n Filter.blank_source transition_length, channel(:video).resolution, channel(:video).fps, \"#{lbl_aux}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.silent_source transition_length, \"#{lbl_aux}:a\"\n ) if channel?(:audio)\n end # NOTE else hope lbl is long enough for the transition\n\n @filters.concat(\n Filter.trim trim_prev_at, trim_prev_at + transition_length, \"#{lbl_pad_}:v\", \"#{lbl_end1}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.atrim trim_prev_at, trim_prev_at + transition_length, \"#{lbl_pad_}:a\", \"#{lbl_end1}:a\"\n ) if channel?(:audio)\n\n # TODO the only supported transition, see #*lay\n @filters.concat(\n Filter.blend_v transition_length, channel(:video).resolution, channel(:video).fps, [\"#{lbl_end1}:v\", \"#{lbl || lbl_aux}:v\"], \"#{lbl_reel}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.blend_a transition_length, [\"#{lbl_end1}:a\", \"#{lbl || lbl_aux}:a\"], \"#{lbl_reel}:a\"\n ) if channel?(:audio)\n\n lbl = lbl_reel\n end\n\n end\n\n segments << lbl # NOTE can be nil\n end\n\n segments.compact!\n\n lbl_out = segments[0]\n\n if segments.size > 1\n lbl_out = \"o#{idx}o\"\n\n @filters.concat(\n Filter.concat_v segments.map{|s| \"#{s}:v\"}, \"#{lbl_out}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.concat_a segments.map{|s| \"#{s}:a\"}, \"#{lbl_out}:a\"\n ) if channel?(:audio)\n end\n\n # Overlays\n\n # NOTE in-process overlays first\n\n @overlays.to_a.each_with_index do |over_reel, i|\n next if over_reel.duck # NOTE this is currently a single case of multi-process... process\n\n fail Error, \"Video overlays are not implemented just yet, sorry...\" if over_reel.reel.channel?(:video)\n\n # Audio overlaying\n\n lbl_nxt = \"o#{idx}o#{i}\"\n\n lbl_over = \"o#{idx}l#{i}\"\n @filters.concat( # NOTE audio only, see above\n over_reel.reel.filters_for lbl_over, video: false, audio: channel(:audio)\n )\n @filters.concat(\n Filter.copy \"#{lbl_out}:v\", \"#{lbl_nxt}:v\"\n ) if channel?(:video)\n @filters.concat(\n Filter.amix_to_first_same_volume [\"#{lbl_out}:a\", \"#{lbl_over}:a\"], \"#{lbl_nxt}:a\"\n ) if channel?(:audio)\n\n lbl_out = lbl_nxt\n end\n\n # NOTE multi-process overlays last\n\n @channel_lbl_ios = {} # XXX this is a spaghetti machine\n @channel_lbl_ios[\"#{lbl_out}:v\"] = io if channel?(:video)\n @channel_lbl_ios[\"#{lbl_out}:a\"] = io if channel?(:audio)\n\n # TODO supporting just \"full\" overlays for now, see exception in #add_reel\n @overlays.to_a.each_with_index do |over_reel, i|\n\n # NOTE this is currently a single case of multi-process... process\n if over_reel.duck\n fail Error, \"Don't know how to duck video... yet\" if over_reel.duck != :audio\n\n Ffmprb.logger.info \"ATTENTION: ducking audio (due to the absence of a simple ffmpeg filter) does not support streaming main input. yet.\"\n\n # So ducking just audio here, ye?\n # XXX check if we're on audio channel\n\n main_av_o = @channel_lbl_ios[\"#{lbl_out}:a\"]\n fail Error, \"Main output does not contain audio to duck\" unless main_av_o\n\n intermediate_extname = Process.intermediate_channel_extname video: main_av_o.channel?(:video), audio: main_av_o.channel?(:audio)\n main_av_inter_i, main_av_inter_o = File.threaded_buffered_fifo(intermediate_extname, reader_open_on_writer_idle_limit: Util::ThreadedIoBuffer.timeout * 2, proc_vis: process)\n @channel_lbl_ios.each do |channel_lbl, io|\n @channel_lbl_ios[channel_lbl] = main_av_inter_i if io == main_av_o # XXX ~~~spaghetti\n end\n process.proc_vis_edge process, main_av_o, :remove\n process.proc_vis_edge process, main_av_inter_i\n Ffmprb.logger.debug \"Re-routed the main audio output (#{main_av_inter_i.path}->...->#{main_av_o.path}) through the process of audio ducking\"\n\n over_a_i, over_a_o = File.threaded_buffered_fifo(Process.intermediate_channel_extname(audio: true, video: false), proc_vis: process)\n lbl_over = \"o#{idx}l#{i}\"\n @filters.concat(\n over_reel.reel.filters_for lbl_over, video: false, audio: channel(:audio)\n )\n @channel_lbl_ios[\"#{lbl_over}:a\"] = over_a_i\n process.proc_vis_edge process, over_a_i\n Ffmprb.logger.debug \"Routed and buffering auxiliary output fifos (#{over_a_i.path}>#{over_a_o.path}) for overlay\"\n\n inter_i, inter_o = File.threaded_buffered_fifo(intermediate_extname, proc_vis: process)\n Ffmprb.logger.debug \"Allocated fifos to buffer media (#{inter_i.path}>#{inter_o.path}) while finding silence\"\n\n ignore_broken_pipes_was = process.ignore_broken_pipes # XXX maybe throw an exception instead?\n process.ignore_broken_pipes = true # NOTE audio ducking process may break the overlay pipe\n\n Util::Thread.new \"audio ducking\" do\n process.proc_vis_edge main_av_inter_o, inter_i # XXX mark it better\n silence = Ffmprb.find_silence(main_av_inter_o, inter_i)\n\n Ffmprb.logger.debug \"Audio ducking with silence: [#{silence.map{|s| \"#{s.start_at}-#{s.end_at}\"}.join ', '}]\"\n\n Process.duck_audio inter_o, over_a_o, silence, main_av_o,\n process_options: {parent: process, ignore_broken_pipes: ignore_broken_pipes_was, timeout: process.timeout},\n video: channel(:video), audio: channel(:audio)\n end\n end\n\n end\n\n @filters\n end",
"def add_filters(filters); end",
"def &( other_filter )\n\t\treturn other_filter if self.promiscuous?\n\t\treturn self.dup if other_filter.promiscuous?\n\t\treturn self.class.new( :and, [self, other_filter] )\n\tend",
"def <<( other )\n\t\t\t@filters << other\n\t\t\treturn self\n\t\tend",
"def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"def strict_filters=(_arg0); end",
"def filter(spectrum)\n\t filters.map do |coefficients|\n\t\tcoefficients.zip(spectrum).map {|coefficient, power| coefficient * power }\n\t\t\t\t\t .reduce(&:+)\n\t end\n\tend",
"def bandpass! left_cutoff, right_cutoff, order\n filter = DualSincFilter.new(\n :sample_rate => @sample_rate,\n :order => order,\n :left_cutoff_freq => left_cutoff,\n :right_cutoff_freq => right_cutoff\n )\n @data = filter.bandpass(@data)\n return self\n end",
"def apply_filter\n end",
"def filter_data(data, action)\n params_combinator = ParamsOperators::Retriever.new(data, action)\n params_combinator.run\n end",
"def get_filtered_data(data)\n self.get_filter_backends.each do |filter_class|\n filter = filter_class.new(controller: self)\n data = filter.get_filtered_data(data)\n end\n\n return data\n end",
"def filters; end",
"def filters; end",
"def apply_instance_filters(ds)\n instance_filters.inject(ds){|ds1, i| ds1.where(*i[0], &i[1])}\n end",
"def filter_on(values)\n @filters << values\n end",
"def next_filter\n unless @filters.size < 2\n self.filter = (filter + 1).modulo(@filters.size)\n self.page = 1\n end\n self\n end",
"def process_2arrays(array_1, array_2)\n shared = array_1 & array_2\n shared_count = shared.count\n\n array_1_unshared = array_1 - shared\n array_2_unshared = array_2 - shared\n\n count_1 = array_1_unshared.count\n count_2 = array_2_unshared.count\n unshared = array_1_unshared + array_2_unshared\n unshared_count = unshared.count\n\n [].push(shared_count, unshared_count, count_1, count_2)\nend",
"def filter_complex\n @filtergraph ||= FilterGraph\n end",
"def filter_prepare(current_filter = @filter, subfilter = @subfilter)\n verified_filter = @filters.assoc(current_filter) ? current_filter : @filters.first[0]\n subfilter ||= {}\n the_filter = @filters.assoc(verified_filter)[1]\n # I had to do this in this kind of funny way to avoid actually modifying @filters.\n find_conditions = the_filter.has_key?(:conditions) ? the_filter[:conditions].dup : ['1']\n find_include = []\n # find_conditions += filter[:conditions] if filter.has_key?(:conditions)\n find_include += the_filter[:include] if the_filter.has_key?(:include)\n # If no subfilters have been checked, this should be skipped, accept all\n # If some subfilters have been checked, only the checked ones will be traversed.\n # Within a single key, two checks yields OR\n # Across keys, two checks yield AND\n # The idea is that the subfilter conditions will read \"field in (?)\"\n # And then the keys will provide the array of options\n subfilter.each do |key, sf|\n fsf = the_filter[:subfilters].assoc(key)[1].dup\n find_conditions[0] += (' and ' + fsf[:conditions])\n find_conditions << sf.keys\n find_include << fsf[:include] if fsf.has_key?(:include)\n end\n total_records = scoped_model.count(:all, :include => find_include, :conditions => find_conditions)\n # puts \"%%%%% FILTER INFO IN FILTER_PREPARE: include:[#{find_include.inspect}], conditions:[#{find_conditions.inspect}].\"\n return[verified_filter, subfilter, find_include, find_conditions, total_records]\n end",
"def Filter=(arg0)",
"def combine_filtered_ids(u_filtered_ids, b_filtered_ids, m_filtered_ids, d_filtered_ids, tenant_filter_ids)\n intersection = ->(operand1, operand2) { [operand1, operand2].compact.reduce(&:&) }\n union = ->(operand1, operand2, operand3 = nil) { [operand1, operand2, operand3].compact.reduce(&:|) }\n\n b_intersection_m = intersection.call(b_filtered_ids, m_filtered_ids)\n u_union_d_union_b_intersection_m = union.call(u_filtered_ids, d_filtered_ids, b_intersection_m)\n\n intersection.call(u_union_d_union_b_intersection_m, tenant_filter_ids)\n end",
"def prepare_data_for_filters\n self.data_grid.columns.each do |col|\n next if col.filter.nil? # if no filter\n\n # Prepare auto filters\n if col.filter == :auto\n self.data_grid.in_data.each do |d|\n if col.sort_by.class == Symbol\n col.filter_data << d.send(col.sort_by)\n else\n # Call lambda\n col.filter_data << col.field.call(d, self.data_grid)\n end\n end\n\n col.filter_data.uniq!\n col.filter_data.sort!\n end\n end\n end",
"def add_or\n\t\[email protected]([]) if @filters.last && @filters.last.size > 0\n\t\treturn self\n\tend",
"def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end",
"def filter_generator; end",
"def create_filtered_signal(a, b, c)\n s = Marshal.load(Marshal.dump(a))\n filter = Array.new(s.length) { 1 }\n (b...c).each do |i|\n filter[i] = 0\n end\n (0...s.length).each do |i|\n s[i] *= filter[i]\n end\n s\n end",
"def get_records_with_filter (&block)\n ui2 = @records_unpacked\n records = []\n\n ui2_size = ui2.size\n offset = 0\n ptr = ui2\n\n while(offset < ui2_size) do\n curr_record_type = ptr[0]\n record_size = ptr[1]\n offset += (record_size/2)\n\n yield records, curr_record_type, offset, ptr\n\n ptr = ptr[(record_size/2)..-1]\n end\n\n records\n end",
"def store_filters #:nodoc:\n record = 0x00EC # Record identifier\n length = 0x0000 # Bytes to follow\n\n ids = @object_ids.dup\n spid = ids.shift\n\n filter_area = @filter_area\n num_filters = @filter_count\n\n num_comments = @comments_array.size\n\n # Number of objects written so far.\n num_objects = @images_array.size + @charts_array.size\n\n # Skip this if there aren't any filters.\n return if num_filters == 0\n\n row1, row2, col1, col2 = @filter_area\n\n (0 .. num_filters-1).each do |i|\n vertices = [ col1 +i, 0, row1 , 0,\n col1 +i +1, 0, row1 +1, 0]\n\n if i == 0 and !num_objects.nil?\n # Write the parent MSODRAWIING record.\n dg_length = 168 + 96*(num_filters -1)\n spgr_length = 144 + 96*(num_filters -1)\n\n dg_length = dg_length + 128 *num_comments\n spgr_length = spgr_length + 128 *num_comments\n\n data = store_mso_dg_container(dg_length) +\n store_mso_dg(*ids) +\n store_mso_spgr_container(spgr_length) +\n store_mso_sp_container(40) +\n store_mso_spgr() +\n store_mso_sp(0x0, spid, 0x0005)\n spid = spid + 1\n data = data + store_mso_sp_container(88) +\n store_mso_sp(201, spid, 0x0A00) +\n store_mso_opt_filter() +\n store_mso_client_anchor(1, *vertices) +\n store_mso_client_data()\n spid = spid + 1\n\n else\n # Write the child MSODRAWIING record.\n data = store_mso_sp_container(88) +\n store_mso_sp(201, spid, 0x0A00) +\n store_mso_opt_filter() +\n store_mso_client_anchor(1, *vertices) +\n store_mso_client_data()\n spid = spid + 1\n end\n length = data.length\n header = [record, length].pack(\"vv\")\n append(header, data)\n\n store_obj_filter(num_objects+i+1, col1 +i)\n end\n\n # Simulate the EXTERNSHEET link between the filter and data using a formula\n # such as '=Sheet1!A1'.\n # TODO. Won't work for external data refs. Also should use a more direct\n # method.\n #\n formula = \"=#{@name}!A1\"\n store_formula(formula)\n\n @object_ids[0] = spid\n end",
"def initialize_copy(other)\n super\n @instance_filters = other.send(:instance_filters).dup\n self\n end",
"def filters\n unless @filters\n @filters = {}\n return @filters unless @params[:f_inclusive] && @params[:f_inclusive].respond_to?(:each_pair)\n @params[:f_inclusive].each_pair do |field, value_array|\n @filters[field] ||= value_array.dup\n end\n end\n @filters\n end",
"def weave_array(array1, array2)\n result = []\n idx1 = 0\n idx2 = 1\n while #some condition\n temp_array = []\n while idx1 < array1.length && idx2 < array2.length\n if\n temp_array.push(array1[idx1])\n idx1 += 1\n end\n if\n temp_array.push(array2[idx2])\n idx2 += 1\n end\n end\n while idx1 < array1.length\n temp_array.push(array1[idx1])\n idx1 += 1\n end\n while idx2 < array2.length\n temp_array.push(array1[idx2])\n idx2 += 1\n end\n result.push(temp_array)\n end\n result\nend",
"def filter(*args, &block)\n if args.length == 1\n args = args.first\n else\n args.freeze\n end\n\n with_opts(:filter=>args, :filter_block=>block)\n end",
"def filters=( args )\n @filters.clear\n add_filters(*args)\n end",
"def process_filter\n # Create the session variable if necessary.\n unless session.has_key?(:filter)\n session[:filter] = Array.new\n end\n\n start_size = session[:filter].length\n \n # Adding to the filter?\n if params.has_key?(:add_to_filter)\n session[:filter] << params[:add_to_filter]\n end\n\n # Removing from the filter?\n if params.has_key?(:remove_from_filter)\n session[:filter].delete_at(session[:filter].index(params[:remove_from_filter]))\n end\n \n # Clearing the filter?\n if params.has_key?(:clear_filter)\n session[:filter].clear\n end\n # If the filter was added to or removed from the size will have changed.\n return session[:filter].length != start_size\n end",
"def apply_filter(type, request, ds)\n if filter = filter_for\n ds = filter.call(ds, type, request)\n end\n ds\n end",
"def filter(arr)\n # create new empty array to populate with filtered elements\n arr2 = []\n # for each element in array, check if it passes the test in the block, called by yield, and if it does add it to the new array\n arr.each { |x| arr2 << x if yield(x) }\n # return the new array, setting the original array to these new values\n arr2\nend",
"def reset_filters\n @_filters = []\n end",
"def |( other_filter )\n\t\treturn other_filter if self.promiscuous?\n\t\treturn self.dup if other_filter.promiscuous?\n\n\t\t# Collapse nested ORs into a single one with an additional alternation\n\t\t# if possible.\n\t\tif self.component.respond_to?( :add_alternation )\n\t\t\tself.log.debug \"collapsing nested ORs...\"\n\t\t\tnewcomp = self.component.dup\n\t\t\tnewcomp.add_alternation( other_filter )\n\t\t\treturn self.class.new( newcomp )\n\t\telse\n\t\t\treturn self.class.new( :or, [self, other_filter] )\n\t\tend\n\tend",
"def filters\n end",
"def get_and_update(data)\n results = []\n new_data = []\n dirty = false\n\n (data || []).each do |pos|\n unless @pred.call(pos)\n new_data.push(pos)\n next\n end\n\n case yield(pos)\n in [:clean, result, _]\n results.push(result)\n new_data.push(pos)\n in [:dirty, result, new_value]\n results.push(result)\n new_data.push(new_value)\n dirty = true\n in :pop\n results.push(pos)\n dirty = true\n end\n end\n\n if dirty\n [:dirty, results, new_data]\n else\n [:clean, results, data]\n end\n end",
"def global_filter(&block)\n @filters[nil] = block\n end",
"def combine!(other)\n return self if other == self\n\n @transaction_count += other.transaction_count\n @call_count += other.call_count\n @rows_returned += other.rows_returned\n @call_time += other.call_time\n\n @min_call_time = other.min_call_time if @min_call_time.zero? or other.min_call_time < @min_call_time\n @max_call_time = other.max_call_time if other.max_call_time > @max_call_time\n\n @min_rows_returned = other.min_rows_returned if @min_rows_returned.zero? or other.min_rows_returned < @min_rows_returned\n @max_rows_returned = other.max_rows_returned if other.max_rows_returned > @max_rows_returned\n\n @histogram.combine!(other.histogram)\n self\n end",
"def filter\n @filter ||= BitArray.new(m)\n end",
"def zip_blocks(blks, filter = writable_mifare_blocks)\n filter.map\n .with_index { |i, x| [i, blks[x]] }\n .reject { |_a, b| b.nil? }\n end",
"def store_autofilters #:nodoc:\n # Skip all columns if no filter have been set.\n return '' if @filter_on == 0\n\n col1 = @filter_area[2]\n col2 = @filter_area[3]\n\n col1.upto(col2) do |i|\n # Reverse order since records are being pre-pended.\n col = col2 -i\n\n # Skip if column doesn't have an active filter.\n next unless @filter_cols[col]\n\n # Retrieve the filter tokens and write the autofilter records.\n store_autofilter(col, *@filter_cols[col])\n end\n end",
"def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end",
"def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end",
"def add_filters(fields, operators, values)\n if fields.is_a?(Array) && operators.is_a?(Hash) && (values.nil? || values.is_a?(Hash))\n fields.each do |field|\n add_filter(field, operators[field], values && values[field])\n end\n end\n end",
"def add_filters(fields, operators, values)\n if fields.is_a?(Array) && operators.is_a?(Hash) && (values.nil? || values.is_a?(Hash))\n fields.each do |field|\n add_filter(field, operators[field], values && values[field])\n end\n end\n end",
"def instance_filter(*args, &block)\n instance_filters << [args, block]\n end",
"def merge_outages(srcdst2outage, srcdst2filter_tracker)\n # TODO should freeze these objects\n outages = srcdst2outage.values\n # Assign unique ids to outages\n @outage_store.transaction do\n outages.each do |outage|\n outage.file = @outage_store.generate_unique_id\n end\n end\n\n # nested helper closure\n allocate_merged_outage = lambda do |outage_list, merging_method|\n id = nil\n merged_outage = nil\n # Generate a unique id\n @merged_outage_store.transaction do\n id = @merged_outage_store.generate_unique_id \n merged_outage = MergedOutage.new(id, outage_list, merging_method)\n end\n outage_list.each do |outage|\n src = outage.src\n dst = outage.dst\n srcdst2filter_tracker[[src,dst]].merged_outage_ids << id\n end\n\n # last statement is the map value\n merged_outage\n end\n \n # Note: bidirectional will appear twice, in forward mergings and reverse\n # mergings\n only_forward = outages.find_all { |o| o.direction.is_forward? }\n dst2outages = only_forward.categorize_on_attr(:dst) \n # Abuse of map... \n forward_merged = dst2outages.values.map do |outage_list|\n allocate_merged_outage.call(outage_list, MergingMethod::FORWARD)\n end\n\n only_reverse = outages.find_all { |o| o.direction.is_reverse? }\n src2outages = only_reverse.categorize_on_attr(:src)\n # Abuse of map... \n reverse_merged = src2outages.values.map do |outage_list|\n allocate_merged_outage.call(outage_list, MergingMethod::REVERSE)\n end\n\n # For debugging. TODO: put me into unit tests instead of here.\n forward_src_dsts = Set.new(forward_merged.map { |merged| merged.map { |o| {:src => o.src, :dst => o.dst} } }.flatten)\n reverse_src_dsts = Set.new(reverse_merged.map { |merged| merged.map { |o| {:src => o.src, :dst => o.dst} } }.flatten)\n all_outages = Set.new(outages.find_all { |o| o.direction.is_forward? or o.direction.is_reverse? }.map { |o| {:src => o.src, :dst => o.dst} })\n if (forward_src_dsts | reverse_src_dsts).size != all_outages.size\n # forward U reverse mergings should contain every (src, dst) pair\n # TODO: raise rather than log?\n @logger.warn { \"Not merging properly! [#{forward_src_dsts.to_a.inspect} #{reverse_src_dsts.to_a.inspect} #{all_outages.to_a.inspect}]\" }\n end\n \n return forward_merged + reverse_merged\n end",
"def filter_clause\n @filters[filter % @filters.size] unless @filters.size.zero?\n end",
"def apply_filters( value, args )\n return value if @callbacks.blank?\n\n @nesting_level += 1\n @iterations[@nesting_level] = @callbacks.keys\n num_args = args.length\n\n @iterations[@nesting_level].each do |priority|\n @current_priority[@nesting_level] = priority\n\n @callbacks[priority].each do |the_|\n\n args[0] = value unless @doing_action\n\n # Avoid the array_slice if possible.\n if the_[:accepted_args] == 0\n value = the_[:function].call\n elsif the_[:accepted_args] >= num_args\n value = the_[:function].call(args)\n else\n value = the_[:function].call(args.slice(0, the_[:accepted_args]))\n end\n end\n end\n @iterations.delete(@nesting_level)\n @current_priority.delete(@nesting_level)\n\n @nesting_level -= 1\n\n value\n end",
"def filter!; end",
"def test_filters_accessor\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n assert_equal([@append_a, @append_b], pipeline.filters)\n end",
"def mutually_exclusive_filters(filter_key, filter_values)\n filters = filter_values.map {|s| filter(filter_key, s)}\n if filters.length > 1\n [\"(#{filters.join(' OR ')})\"]\n elsif filters.length == 1\n [\"#{filters[0]}\"]\n else\n []\n end\n end",
"def initialize\n @filters = []\n end",
"def couple_filter_results(original, filtered)\n h = Hash.new()\n original.each do |k, v|\n h[k] = v.to_a - filtered[k]\n end\n return h\n end",
"def << data\n\n # Update min/max\n if 0 == @count\n @min = data\n @max = data\n else\n @max = data if data > @max\n @min = data if data < @min\n end\n\n # Update the running info\n @count += 1\n @sum += data\n @sum2 += (data * data)\n\n # Update the bucket\n @buckets[to_index(data)] += 1 unless outlier?(data)\n end",
"def global_filter=(_arg0); end",
"def filters\n unless (@filters)\n @filters = {}\n return @filters unless @params[:f_inclusive]\n @params[:f_inclusive].each_pair do |field, value_hash|\n value_hash.each_pair do |value, type|\n @filters[field] ||= []\n @filters[field] << value\n end\n end \n end\n return @filters\n end",
"def init_filter(elements, fp_rate)\n ln2 = Math.log(2)\n\n # using #ceil instead of #floor may be better, but it's bitcoinj's way\n\n calc_m = (-Math.log(fp_rate) * elements / ln2 / ln2 / 8).floor\n @filter_size = [1, [calc_m, MAX_FILTER_SIZE].min].max\n @filter = \"\\x00\" * @filter_size\n\n calc_k = (@filter_size * 8 * ln2 / elements).floor\n @nfunc = [1, [calc_k, MAX_HASH_FUNCS].min].max\n end",
"def add_or_filters(fields, operators, values)\n if fields.present? && operators.present?\n fields.each do |field|\n # Smile specific #340206 Filtre additifs\n add_or_filter(field, operators[field], values && values[field])\n end\n end\n end",
"def run_filters\n status = :no_match\n matching_filters = [] \n DataFileFilter.active.each do |filter|\n case filter.match(self)\n when :positive_match\n status = :accepted if status == :no_match\n matching_filters << filter\n when :negative_match\n status = :rejected\n matching_filters << filter\n when :no_match\n next\n end\n end\n return [status,matching_filters]\n end",
"def filter(*args, &block)\n @filter = block ? Filter.new(*args, &block) : args.first\n self\n end",
"def prepare_filters(filters, page, per_page, filter_group_start_index = 0)\n filter_array = []\n if filters.present?\n filters[:filter_groups].each_with_index do |filter_group, group_index|\n filter_group[:filters].each_with_index do |filter, filter_index|\n filter_string = \"searchCriteria[filter_groups][#{group_index + filter_group_start_index}][filters][#{filter_index}][field]=#{filter[:field]}&\"\n filter_string += \"searchCriteria[filter_groups][#{group_index + filter_group_start_index}][filters][#{filter_index}][value]=#{filter[:value]}&\"\n filter_string += \"searchCriteria[filter_groups][#{group_index + filter_group_start_index}][filters][#{filter_index}][conditionType]=#{filter[:condition]}\"\n filter_array.push(filter_string)\n end\n end\n\n filters[:order].each_with_index do |order, index|\n order_string = \"searchCriteria[sortOrders][#{index}][field]=#{order[:field]}&\"\n order_string += \"searchCriteria[sortOrders][#{index}][direction]=#{order[:direction]}\"\n filter_array.push(order_string)\n end\n end\n\n filter_array.push(\"searchCriteria[pageSize]=#{per_page}\") if per_page.present?\n filter_array.push(\"searchCriteria[currentPage]=#{page}\") if page.present?\n filter_array.join '&'\n end",
"def part1AccumulatorFunction()\n ->(acc,digest) { acc + [digest] }\nend",
"def filtered_dataset\n filter_args_from_query.inject(@dataset) do |filter, cond|\n filter.filter(cond)\n end\n end",
"def remove_filters!\n @filters = []\n end",
"def add_filters(filters)\n filters.each do |field, value|\n Array(value).each { |v| add_filter(field, v) }\n end\n end",
"def add_filters(fields, operators, values)\n fields.each do |field|\n add_filter(field, operators[field], values[field])\n end\n end",
"def populate_filters(_inputs)\n super.tap do\n self.class.filters.each do |name, filter|\n next if given?(name)\n\n model_field = self.class.model_field_cache_inverse[name]\n next if model_field.nil?\n\n value = public_send(model_field)&.public_send(name)\n public_send(\"#{name}=\", filter.clean(value, self))\n end\n end\n end",
"def addfilter( newfilter )\n if not subfilter\n @subfilter = newfilter\n else\n subfilter.addfilter( newfilter )\n end\n return self\n end",
"def test_filter_returns_new_instance\n stream = FromArray.new([2, 4, 6, 8])\n assert(!stream.filter(&:odd?).equal?(stream))\n assert(stream.collect == [2, 4, 6, 8])\n end",
"def filter(x)\n w1=@w\n @w=((x-2*w1)*@k)+w1\n @result[:lowpass]=@w+w1\n @result[:highpass]=x-@result[:lowpass]\n @result\n end",
"def preFetchFilter\n @filtered = Filter.new(@combinedWaypoints)\n debug \"Filter running cycle 1, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['cacheType']\n # post-filter by cacheType\n @appliedFilters['-c'] = { 'f' => \"#{@option['cacheType']}\", 't' => \"type\" }\n # event+ is now all_event, unknown+ is now all_unknown\n if @option['cacheType'] !~ /\\+$/ and\n @option['cacheType'] !~ /^all_/\n # but only if there's no \"all xxx\" chosen\n # we must trust that the query returns correct data here...\n @filtered.cacheType(@option['cacheType'])\n else\n displayWarning \"Not filtering for cache type!\"\n end\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Cache type\")\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeArchived']\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeDisabled']\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @filtered.removeByElement('membersonly')\n end\n # may not be accurate before fetching details?\n if @option['onlyPMO']\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n if $DTSFILTER\n #-------------------\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n #-------------------\n end # $DTSFILTER\n\n debug \"Filter running cycle 2, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['foundDateInclude']\n @appliedFilters['-r'] = { 'f' => \"#{@option['foundDateInclude']}\", 't' => \"found age max\" }\n @filtered.foundDateInclude(@option['foundDateInclude'].to_f)\n end\n if @option['foundDateExclude']\n @appliedFilters['-R'] = { 'f' => \"#{@option['foundDateExclude']}\", 't' => \"found age min\" }\n @filtered.foundDateExclude(@option['foundDateExclude'].to_f)\n end\n if @option['placeDateInclude']\n @appliedFilters['-j'] = { 'f' => \"#{@option['placeDateInclude']}\", 't' => \"cache age max\" }\n @filtered.placeDateInclude(@option['placeDateInclude'].to_f)\n end\n if @option['placeDateExclude']\n @appliedFilters['-J'] = { 'f' => \"#{@option['placeDateExclude']}\", 't' => \"cache age min\" }\n @filtered.placeDateExclude(@option['placeDateExclude'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Date\")\n\n debug \"Filter running cycle 3, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['notFound']\n @appliedFilters['-n'] = { 'f' => \"\", 't' => \"virgins\" }\n @filtered.notFound\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Unfound\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['travelBug']\n @appliedFilters['-b'] = { 'f' => \"\", 't' => \"trackables\" }\n @filtered.travelBug\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Trackable\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['ownerExclude']\n @appliedFilters['-I'] = { 'f' => \"#{@option['ownerExclude']}\", 't' => \"not owned by\" }\n @option['ownerExclude'].split($delimiters).each{ |owner|\n @filtered.ownerExclude(owner)\n }\n end\n if @option['ownerInclude']\n @appliedFilters['-i'] = { 'f' => \"#{@option['ownerInclude']}\", 't' => \"owned by\" }\n @option['ownerInclude'].split($delimiters).each{ |owner|\n @filtered.ownerInclude(owner)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Owner\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['titleKeyword']\n @appliedFilters['-k'] = { 'f' => \"#{@option['titleKeyword']}\", 't' => \"matching title keyword\" }\n @filtered.titleKeyword(@option['titleKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Title\")\n\n displayMessage \"Pre-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n end",
"def batch(items)\n items.select { |i| filter(i) }\n end",
"def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end",
"def filters\n @filters ||= {}\n end",
"def subtract(arr, filter)\n\n a = arr.length - 1\n f = filter.length - 1\n \n while a >= 0\n if (a >= 0 && f < 0) || arr[a][0] > filter[f] \n arr.delete_at(a)\n a -= 1\n elsif arr[a][0] < filter[f]\n f -= 1 \n else \n a -= 1\n f -= 1\n end\n end\n \n end",
"def pipe(other)\n Pipeline.new(@pipes + [other])\n end",
"def filters\n\t\t@filters_array = Array(@profile[:filters]) unless(@filters_array)\n\t\t@filters_array.each do |filter|\n\n\t\t\tif respond_to?( \"filter_#{filter}\" )\n\t\t\t\[email protected] do |field|\n\t\t\t\t\t# If a key has multiple elements, apply filter to each element\n\t\t\t\t\t@field_array = Array( @form[field] )\n\n\t\t\t\t\tif @field_array.length > 1\n\t\t\t\t\t\t@field_array.each_index do |i|\n\t\t\t\t\t\t\telem = @field_array[i]\n\t\t\t\t\t\t\t@field_array[i] = self.send(\"filter_#{filter}\", elem)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif not @form[field].to_s.empty?\n\t\t\t\t\t\t\t@form[field] = self.send(\"filter_#{filter}\", @form[field].to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@form\n\tend",
"def image_processing\n \tpixel_array_img1 = read_file_image(\"book4_no_table.jpg\")\n \tpixel_array_img2 = read_file_image(\"net_book5.jpg\")\n\n\n \tpixel_array_sq_img1 = []\n \tpixel_array_sq_img2 = []\n \tpixel_array_img1x2 = []\n \t##################FALTA AQUI ALGO\n\n \t###### ARRAY OF PIXEL ARRAY\n \t# SQUARE IMAGE IMG_1\n \tpixel_array_sq_img1 = square_array(pixel_array_img1)\t\t\n\t\tpixel_array_sq_img2 = square_array(pixel_array_img2)\n \tpixel_array_img1x2 = product_array(pixel_array_img1,pixel_array_img2)\n\n\t\t# Apply convolve filter two image array\n\t\timg_1_convolve_filter = convolve(pixel_array_img1,@gaussian_kernel)\n\t\timg_2_convolve_filter = convolve(pixel_array_img2,@gaussian_kernel)\n\n\t\t## Array Square\n\t\timg_1_convolve_filter_sq = square_array(img_1_convolve_filter)\n\t\timg_2_convolve_filter_sq = square_array(img_2_convolve_filter)\n\t\timg_2x1_convolve_filter = product_array(img_1_convolve_filter,img_2_convolve_filter)\n\n\t\t#Convolve FILTER Square IMG1 and IMG2\n\t\timg_1_sq_convolve_filter = convolve(pixel_array_sq_img1,@gaussian_kernel)\n\t\timg_2_sq_convolve_filter = convolve(pixel_array_sq_img2,@gaussian_kernel)\n\n\t\t#Convolve FILTER to Product IMG1 and IMG2 \n\t\timg_1x2_convolve_filter = convolve(pixel_array_img1x2,@gaussian_kernel)\n\n\t\timg_1_sq_convolve_filter = difference_array(img_1_sq_convolve_filter,img_1_convolve_filter_sq)\n\t\timg_2_sq_convolve_filter = difference_array(img_2_sq_convolve_filter,img_2_convolve_filter_sq)\n\t\timg_1x2_convolve_filter = difference_array(img_1x2_convolve_filter,img_2x1_convolve_filter)\n\n\n\n\t\t#c1/c2 constants\n\t #First use: manual fitting\n\t c_1=6.5025\n\t c_2=58.5225\n\t \n\t #Second use: change k1,k2 & c1,c2 depend on L (width of color map)\n\t l=255\n\t k_1=0.01\n\t c_1=(k_1*l)**2\n\t k_2=0.03\n\t c_2=(k_2*l)**2\n\t \n\t #Numerator of SSIM\n\t num_ssim = \n\t product_array(\n\t \tmultiple_and_factor_increment(2,img_2x1_convolve_filter,c_1),\n\t \tmultiple_and_factor_increment(2,img_1x2_convolve_filter,c_2))\n\t ##Denominator of SSIM\n\t den_ssim = product_array(sum_two_array_and_incremente(img_1_convolve_filter_sq,img_2_convolve_filter_sq,c_1),sum_two_array_and_incremente(img_1_sq_convolve_filter,img_2_sq_convolve_filter,c_2))\n\t ##SSIM\n\t index = division_and_average(num_ssim,den_ssim)\n\n\t puts index\n\n end",
"def process_with_window\r\n @processed_time_data = time_data.take(time_data_size).times self.window.values\r\n self.strategy.data = @processed_time_data\r\n @fft = self.strategy.calculate\r\n @data = @fft\r\n end",
"def test_filters_no_elements\n stream = FromArray.new([2, 4, 6, 8])\n collected = stream.filter { |num| num % 2 == 0 }.collect\n assert(stream.collect == collected)\n end",
"def apply_filters_ref_array( tag, args )\n # global $wp_filter, $wp_current_filter;\n\n # Do 'all' actions first\n if ( isset( Railspress.GLOBAL.wp_filter['all'] ) )\n Railspress.GLOBAL.wp_current_filter << tag\n all_args = func_get_args()\n _wp_call_all_hook(all_args )\n end\n\n if (!isset(Railspress.GLOBAL.wp_filter[$tag]))\n if (isset(Railspress.GLOBAL.wp_filter['all']))\n array_pop(Railspress.GLOBAL.wp_current_filter)\n end\n return $args[0]\n end\n\n if (!isset(Railspress.GLOBAL.wp_filter['all']))\n Railspress.GLOBAL.wp_current_filter << tag\n end\n\n filtered = Railspress.GLOBAL.wp_filter[tag].apply_filters(args[0], args)\n\n array_pop(Railspress.GLOBAL.wp_current_filter)\n\n return filtered\n end",
"def filters=(*filters)\n @filters = filters.flatten\n end",
"def build\n \"filter=#{filters.join(',')}\"\n end",
"def filter(arr, &block)\n if arr.empty?\n []\n else\n head, *tail = arr\n if block.call(head) == true\n [head] + filter(tail, &block)\n else\n filter(tail, &block)\n end\n end\nend",
"def filter (data)\n # leave the data untouched if we don't support the required filter\n return data if @filter.nil?\n\n # decode the data\n self.send(@filter, data)\n end",
"def partition(filters={})\n input, output = self.input, self.output\n filters.each_pair do |filter_key, f|\n if f.call(input, output)\n return filter_key\n end\n end\n nil\n end"
] | [
"0.60112584",
"0.5815165",
"0.5615223",
"0.55344373",
"0.55100226",
"0.5499482",
"0.54939103",
"0.54939103",
"0.53486264",
"0.5314544",
"0.5311366",
"0.5225281",
"0.5190498",
"0.5177989",
"0.5154586",
"0.5133524",
"0.510491",
"0.50550777",
"0.5044201",
"0.5042721",
"0.49966007",
"0.49742818",
"0.49742818",
"0.49686763",
"0.49677593",
"0.4961577",
"0.49450856",
"0.49420908",
"0.49175587",
"0.49147666",
"0.49003953",
"0.4895365",
"0.48897845",
"0.48800477",
"0.48674467",
"0.4857443",
"0.48548776",
"0.48543096",
"0.48148212",
"0.4809177",
"0.4805652",
"0.48002324",
"0.47899297",
"0.47831878",
"0.47759685",
"0.477271",
"0.47676653",
"0.47523138",
"0.47510672",
"0.47459495",
"0.4730103",
"0.472012",
"0.47113377",
"0.4707583",
"0.46976528",
"0.46973708",
"0.46973708",
"0.46870548",
"0.46870548",
"0.46821213",
"0.467915",
"0.46783856",
"0.46532983",
"0.46520248",
"0.4650198",
"0.46486065",
"0.46477574",
"0.46474987",
"0.46423447",
"0.46418467",
"0.46396336",
"0.4630003",
"0.46253896",
"0.4620338",
"0.46178523",
"0.46166688",
"0.4614695",
"0.46140438",
"0.46077144",
"0.45914578",
"0.45902523",
"0.45832682",
"0.4579876",
"0.45751935",
"0.45746598",
"0.45745343",
"0.45736796",
"0.45664075",
"0.4562269",
"0.45588073",
"0.4556063",
"0.45520374",
"0.45417437",
"0.4537905",
"0.45328173",
"0.45320496",
"0.4530214",
"0.45167235",
"0.45154154",
"0.45121652",
"0.45106953"
] | 0.0 | -1 |
The signal is premixed into the filter. We adjust the master phase every time we filter. mix_phase = mix_phase_inc faster than sin+cos Take out the rounding errors once in a while with: mix_phase /= mix_phase.abs | def premix_filter coef, mix
return coef unless mix and mix != 0
rate = PI2 * mix
i = coef.size
coef.collect do |coef|
i -= 1
coef * Math.exp(Complex(0.0,rate*i))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FFT2(in_signal, in_step, in_prev_sum)\n sum = 0\n the_start_index = in_step - 1\n# add the next in_step numbers\n end_add_indices = the_start_index + in_step\n if end_add_indices > in_signal.size # we only need to add 'shortcut'\n end_add_indices = in_signal.size\n if in_prev_sum > 0 && the_start_index > 0\n sum = in_prev_sum - in_signal[the_start_index - 1]\n return sum.abs % 10, sum\n end\n end\n phase_array = phase_array_for_step(in_step)\n\n sum = in_signal[the_start_index..(end_add_indices-1)].inject(0){|sum,x| sum + x }\n if in_signal.size > end_add_indices\n the_phase_index = end_add_indices % (phase_array.size)\n in_signal[end_add_indices..-1].each_with_index do |val, i|\n the_phase = phase_array[the_phase_index]\n if the_phase == 1\n sum += val\n elsif the_phase == -1\n sum -= val\n end\n the_phase_index += 1\n the_phase_index = 0 if the_phase_index >= phase_array.size\n end\n else\n return sum.abs % 10, sum\n end\n return sum.abs % 10, 0\nend",
"def FFT3(in_signal, in_step)\n phase_array = phase_array_for_step(in_step)\n the_phase_array = phase_array * (in_signal.size / phase_array.size + 1)\n\n the_one_array = []\n the_minus_array = []\n sum = 0\n the_start_index = in_step - 1\n in_signal[the_start_index..-1].each_with_index do |val, i|\n the_phase = the_phase_array[the_start_index + i ]\n if the_phase != 0\n if the_phase == 1\n the_one_array << val\n elsif the_phase == -1\n the_minus_array << val\n end\n end\n end\n sum = the_one_array.inject(0){|sum,x| sum + x } - the_minus_array.inject(0){|sum,x| sum + x }\n sum.abs % 10\nend",
"def set_volume_cuft\n self.volume_cuft = (self.length_ins/12) * (self.width_ins/12) * (self.height_ins/12)\n end",
"def wave\n bell.mix(saw, saw.pitch(0.505))\n end",
"def mix(wave)\n other = wave.dps\n longest = dps.count > other.count ? dps : other\n longest.each_with_index do |a,i|\n my_v = (dps[i].nil? ? 0 : dps[i])\n oth_v = (other[i].nil? ? 0 : other[i])\n dps[i] = my_v + oth_v \n end\n self\nend",
"def FFT4(in_signal, in_step)\n the_signal_size = in_signal.size\n phase_array = phase_array_for_step(in_step)\n phase_array_size = phase_array.size\n\n the_start_index = in_step - 1 # skip the leading zeros\n sum = 0\n phase_array[the_start_index..-1].each_with_index do |val, i|\n if val != 0 && i < the_signal_size\n the_index = i + the_start_index\n part_sum = 0\n while the_index < the_signal_size\n part_sum += in_signal[the_index]\n the_index += phase_array_size\n end\n sum += (val * part_sum)\n end\n end\n sum.abs % 10\nend",
"def testUselessCalibratedTrack\n execute_Mix_WithConf({\n :Recordings => {\n :EnvCalibration => {\n [ :Env1, :Env4 ] => {\n :CompareCuts => ['0.01s', '0.16s']\n }\n },\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :CalibrateWithEnv => :Env4\n }\n }\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n [1] => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1_CalibEnv4, :Cleaned_Env1_1_CalibEnv4, :Calibrated_Env1_1_CalibEnv4)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Env1.1.04.NoiseGate.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert Dir.glob('05_Mix/Env1.1.Calibrated.0.Test.????????????????????????????????.wav').empty?\n assert_wave_lnk '02_Clean/Record/Env1.1.04.NoiseGate', '05_Mix/Final/Final.wav'\n end\n end",
"def around_upload(io, context)\n @super_audio = super\n\n return unless context[:phase] == :cache\n\n path = io.respond_to?(:tempfile) ? io.tempfile.path : io.path\n audio = FFMPEG::Movie.new(path)\n wav = Tempfile.new(['forwaveform', '.wav'])\n\n return unless audio_valid?(audio)\n audio.transcode(wav.path)\n\n peaks = []\n length = 60\n info = WaveFile::Reader.info(wav.path)\n sample_size = info.sample_frame_count / length\n\n WaveFile::Reader.new(wav.path, WaveFile::Format.new(:mono, :float, 44_100)) do |reader|\n reader.each_buffer(sample_size) do |buffer|\n intermediary = []\n steps = buffer.samples.length / 10\n (0..9).each do |step|\n intermediary.push(buffer.samples[step * steps].round(2))\n end\n peaks.push(intermediary.max)\n peaks.push(intermediary.min)\n end\n\n @super_audio.metadata.update('peaks' => peaks)\n end\n end",
"def testSingleTrackWithCalibrationWithoutDCOffset\n execute_Clean_WithConf({\n :Recordings => {\n :EnvCalibration => {\n [ :Env1, :Env3 ] => {\n :CompareCuts => ['0.01s', '0.16s']\n }\n },\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :CalibrateWithEnv => :Env3\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1_CalibEnv3),\n :FakeWSK => [\n # Clean Calibration Env1 Env3\n {\n :Input => '01_Source/Record/Calibration.Env1.Env3.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Calibration.Env1.Env3.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env1.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'FFT',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'FFT/Env1.Silence.fftprofile' => 'fft.result' }\n },\n {\n :Input => '01_Source/Record/Env1.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env1.Silence.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Calibration.Env1.Env3.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env3.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env3.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env1.Env3.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env3.02.Cut.0.01s_0.16s.wav',\n :Action => 'Cut',\n :Params => [ '--begin', '0.01s', '--end', '0.16s' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env3.02.Cut.0.01s_0.16s.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env1.Env3.02.Cut.0.01s_0.16s.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env3.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env3.04.NoiseGate.wav'\n },\n # Clean Calibration Env3 Env1\n {\n :Input => '01_Source/Record/Calibration.Env3.Env1.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Calibration.Env3.Env1.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env3.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'FFT',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'FFT/Env3.Silence.fftprofile' => 'fft.result' }\n },\n {\n :Input => '01_Source/Record/Env3.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env3.Silence.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Calibration.Env3.Env1.wav',\n :Output => '02_Clean/Record/Calibration.Env3.Env1.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-7601,7577', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env3.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env3.Env1.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env3.Env1.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Calibration.Env3.Env1.02.Cut.0.01s_0.16s.wav',\n :Action => 'Cut',\n :Params => [ '--begin', '0.01s', '--end', '0.16s' ],\n :UseWave => '02_Clean/Record/Calibration.Env3.Env1.02.Cut.0.01s_0.16s.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env3.Env1.02.Cut.0.01s_0.16s.wav',\n :Output => '02_Clean/Record/Calibration.Env3.Env1.03.DCShifter.wav',\n :Action => 'DCShifter',\n :Params => [ '--offset', '94' ],\n :UseWave => '02_Clean/Record/Calibration.Env3.Env1.03.DCShifter.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env3.Env1.03.DCShifter.wav',\n :Output => '02_Clean/Record/Calibration.Env3.Env1.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-7507,7671', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env3.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env3.Env1.04.NoiseGate.wav'\n },\n # Clean Track 1\n {\n :Input => '01_Source/Record/Env1.1.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env1.1.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env1.1.wav',\n :Output => '02_Clean/Record/Env1.1.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-3604,3607', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Env1.1.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Env1.1.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Env1.1.03.DCShifter.wav',\n :Action => 'DCShifter',\n :Params => [ '--offset', '2' ],\n :UseWave => '02_Clean/Record/Env1.1.03.DCShifter.wav'\n },\n {\n :Input => '02_Clean/Record/Env1.1.03.DCShifter.wav',\n :Output => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Env1.1.04.NoiseGate.wav'\n }\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert File.exists?('Analyze/Record/Env1.1.analyze')\n assert File.exists?('Analyze/Record/Env1.Silence.analyze')\n assert File.exists?('Analyze/Record/Env1.Silence.fftprofile')\n assert File.exists?('Analyze/Record/Env3.Silence.analyze')\n assert File.exists?('Analyze/Record/Env3.Silence.fftprofile')\n assert File.exists?('Analyze/Record/Calibration.Env1.Env3.analyze')\n assert File.exists?('Analyze/Record/Calibration.Env3.Env1.analyze')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env3.01.SilenceRemover.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env3.02.Cut.0.01s_0.16s.wav')\n assert !File.exists?('02_Clean/Record/Calibration.Env1.Env3.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env3.04.NoiseGate.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env3.Env1.01.SilenceRemover.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env3.Env1.02.Cut.0.01s_0.16s.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env3.Env1.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env3.Env1.04.NoiseGate.wav')\n assert File.exists?('02_Clean/Record/Env1.1.01.SilenceRemover.wav')\n assert !File.exists?('02_Clean/Record/Env1.1.02.Cut.0.01s_0.16s.wav')\n assert File.exists?('02_Clean/Record/Env1.1.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Env1.1.04.NoiseGate.wav')\n end\n end",
"def test_pv_1\n pv = make_phase_vocoder(false, 512, 4, 128, 1.0, false, false, false)\n rd = make_sampler(0)\n map_channel(lambda do |y| phase_vocoder(pv, lambda do |dir| next_sample(rd) end) end)\n free_sampler(rd)\nend",
"def remix(drinks)\n alcohols = strip(drinks, 0)\n mixers = strip(drinks, 1)\n solution = mixer(alcohols, mixers)\nend",
"def testSingleTrackWithDCOffsetAndCalibration\n execute_Clean_WithConf({\n :Recordings => {\n :EnvCalibration => {\n [ :Env1, :Env2 ] => {\n :CompareCuts => ['0.01s', '0.16s']\n }\n },\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :CalibrateWithEnv => :Env2\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1_CalibEnv2),\n :FakeWSK => [\n # Clean Calibration Env1 Env2\n {\n :Input => '01_Source/Record/Calibration.Env1.Env2.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Calibration.Env1.Env2.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env1.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'FFT',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'FFT/Env1.Silence.fftprofile' => 'fft.result' }\n },\n {\n :Input => '01_Source/Record/Env1.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env1.Silence.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Calibration.Env1.Env2.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env2.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-3604,3607', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env2.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env1.Env2.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env2.02.Cut.0.01s_0.16s.wav',\n :Action => 'Cut',\n :Params => [ '--begin', '0.01s', '--end', '0.16s' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env2.02.Cut.0.01s_0.16s.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env1.Env2.02.Cut.0.01s_0.16s.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env2.03.DCShifter.wav',\n :Action => 'DCShifter',\n :Params => [ '--offset', '2' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env2.03.DCShifter.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env1.Env2.03.DCShifter.wav',\n :Output => '02_Clean/Record/Calibration.Env1.Env2.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env1.Env2.04.NoiseGate.wav'\n },\n # Clean Calibration Env2 Env1\n {\n :Input => '01_Source/Record/Calibration.Env2.Env1.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Calibration.Env2.Env1.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env2.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'FFT',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'FFT/Env2.Silence.fftprofile' => 'fft.result' }\n },\n {\n :Input => '01_Source/Record/Env2.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env2.Silence.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Calibration.Env2.Env1.wav',\n :Output => '02_Clean/Record/Calibration.Env2.Env1.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-7601,7577', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env2.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env2.Env1.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env2.Env1.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Calibration.Env2.Env1.02.Cut.0.01s_0.16s.wav',\n :Action => 'Cut',\n :Params => [ '--begin', '0.01s', '--end', '0.16s' ],\n :UseWave => '02_Clean/Record/Calibration.Env2.Env1.02.Cut.0.01s_0.16s.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env2.Env1.02.Cut.0.01s_0.16s.wav',\n :Output => '02_Clean/Record/Calibration.Env2.Env1.03.DCShifter.wav',\n :Action => 'DCShifter',\n :Params => [ '--offset', '94' ],\n :UseWave => '02_Clean/Record/Calibration.Env2.Env1.03.DCShifter.wav'\n },\n {\n :Input => '02_Clean/Record/Calibration.Env2.Env1.03.DCShifter.wav',\n :Output => '02_Clean/Record/Calibration.Env2.Env1.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-7507,7671', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env2.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Calibration.Env2.Env1.04.NoiseGate.wav'\n },\n # Clean Track 1\n {\n :Input => '01_Source/Record/Env1.1.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env1.1.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env1.1.wav',\n :Output => '02_Clean/Record/Env1.1.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-3604,3607', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Env1.1.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Env1.1.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Env1.1.03.DCShifter.wav',\n :Action => 'DCShifter',\n :Params => [ '--offset', '2' ],\n :UseWave => '02_Clean/Record/Env1.1.03.DCShifter.wav'\n },\n {\n :Input => '02_Clean/Record/Env1.1.03.DCShifter.wav',\n :Output => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Env1.1.04.NoiseGate.wav'\n }\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert File.exists?('Analyze/Record/Env1.1.analyze')\n assert File.exists?('Analyze/Record/Env1.Silence.analyze')\n assert File.exists?('Analyze/Record/Env1.Silence.fftprofile')\n assert File.exists?('Analyze/Record/Env2.Silence.analyze')\n assert File.exists?('Analyze/Record/Env2.Silence.fftprofile')\n assert File.exists?('Analyze/Record/Calibration.Env1.Env2.analyze')\n assert File.exists?('Analyze/Record/Calibration.Env2.Env1.analyze')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env2.01.SilenceRemover.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env2.02.Cut.0.01s_0.16s.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env2.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env1.Env2.04.NoiseGate.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env2.Env1.01.SilenceRemover.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env2.Env1.02.Cut.0.01s_0.16s.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env2.Env1.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Calibration.Env2.Env1.04.NoiseGate.wav')\n assert File.exists?('02_Clean/Record/Env1.1.01.SilenceRemover.wav')\n assert !File.exists?('02_Clean/Record/Env1.1.02.Cut.0.01s_0.16s.wav')\n assert File.exists?('02_Clean/Record/Env1.1.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Env1.1.04.NoiseGate.wav')\n end\n end",
"def testCalibratedTrack\n execute_Mix_WithConf({\n :Recordings => {\n :EnvCalibration => {\n [ :Env1, :Env2 ] => {\n :CompareCuts => ['0.01s', '0.16s']\n }\n },\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :CalibrateWithEnv => :Env2\n }\n }\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n [1] => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1_CalibEnv2, :Cleaned_Env1_1_CalibEnv2, :Calibrated_Env1_1_CalibEnv2)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Env1.1.Calibrated.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => '03_Calibrate/Record/Env1.1.Calibrated.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert Dir.glob('05_Mix/Env1.1.04.NoiseGate.0.Test.????????????????????????????????.wav').empty?\n assert_wave_lnk '03_Calibrate/Record/Env1.1.Calibrated', '05_Mix/Final/Final.wav'\n end\n end",
"def testReuseMixWithSourceFilesProcessed\n lProcessID = {\n :Param1 => 'TestParam1'\n }.unique_id\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Mix1' => {\n :Tracks => {\n 'Wave.wav' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n 'Final' => {\n :Tracks => {\n 'Mix1' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam2'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ],\n [ 'Wave/Noise1s.wav', \"05_Mix/Wave.0.Test.#{lProcessID}.wav\" ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => \"05_Mix/Wave.0.Test.#{lProcessID}.wav\",\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam2'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Noise1s', '05_Mix/Final/Mix1.wav'\n assert_wave_lnk 'Noise1s', '05_Mix/Final/Final.wav'\n end\n end",
"def mix mixed_ammount = 0.25\n last_start = 0.0\n dist.branches.times do |i|\n self[i].clear_hits\n self[i] << last_start\n last_start = last_start + (1.0 - mixed_ammount) * (1.0/dist.branches)\n end\n end",
"def initialize(size:, window: RectangularWindow, wc: , correct: true)\r\n super(size: size, window: window)\r\n wc = wc + @window.transition_width * PI if correct\r\n @equation = ->(n){ \r\n n == 0 ? (wc / PI) : (Math.sin(wc * n) / (PI * n)) \r\n }\r\n ideal_filter = calculate_ideal\r\n @weights = self.window.values.times ideal_filter\r\n @fft = Digiproc::FFT.new(time_data: self.weights)\r\n @fft.calculate\r\n end",
"def setup\n sketch_title 'Additive Wave Exercise'\n @w = width + 16 # Width of entire wave\n @xspacing = 8 # How far apart should each horizontal location be spaced\n @theta = 0.0\n @amplitudes = (0..MAX_WAVES).map { rand(10..30) }\n # @dx = Array.new(MAX_WAVES) do |x| # Value for incrementing X, to be calculated as a function of period and xspacing\n # period = rand(100..300) # How many pixels before the wave repeats\n # (TWO_PI / period) * @xspacing\n # end\n @dx = (0..MAX_WAVES).map do\n period = rand(100..300) # How many pixels before the wave repeats\n (TWO_PI / period) * @xspacing\n end\nend",
"def resample_hybrid! upsample_factor, downsample_factor, filter_order\n @data = HybridResampling.resample @data, @sample_rate, upsample_factor, downsample_factor, filter_order\n @sample_rate *= upsample_factor\n @sample_rate /= downsample_factor\n return self\n end",
"def resample_hybrid upsample_factor, downsample_factor, filter_order\n return self.clone.resample_hybrid!(upsample_factor, downsample_factor, filter_order)\n end",
"def testReuseMixWithMixProcessed\n lProcessID = {\n :Param1 => 'TestParam1'\n }.unique_id\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Mix1' => {\n :Tracks => {\n 'Wave.wav' => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n },\n 'Final' => {\n :Tracks => {\n 'Mix1' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam2'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ],\n [ 'Wave/Noise1s.wav', \"05_Mix/Wave.0.Test.#{lProcessID}.wav\" ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => \"05_Mix/Wave.0.Test.#{lProcessID}.wav\",\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam2'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Noise1s', '05_Mix/Final/Mix1.wav'\n assert_wave_lnk 'Noise1s', '05_Mix/Final/Final.wav'\n end\n end",
"def process_audio\n `ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`\n `mp4fragment #{audio_filepath} #{audio_filepath_fragmented}`\n FileUtils.rm audio_filepath\n end",
"def mov_macros_2s(amp=0.1)\n use_bpm 70\n with_fx :level, amp: amp do\n in_thread do\n 2.times do |i|\n s = :elec_tick\n\n n = [2, 4, 8].choose\n pan = rrand(-1, 0)\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rrand(1,4), amp: 1\n end\n\n pan = rrand(-1,1)\n rate = 2\n amp = 0.5\n n = [2, 4].choose\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n use_synth :cnoise\n play :e5, release: 0.125, amp: 1\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: 1\n end\n\n n = [4, 4, 4, 8].choose\n pan = 0\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :drum_cymbal_closed, pan: -pan, rate: rrand(1,4), amp: 1\n end\n sleep 0.125\n sleep 0.125\n end\n end\n end\nend",
"def testSingleTrackWithoutDCOffset\n execute_Clean_WithConf({\n :Recordings => {\n :Tracks => {\n [2] => {\n :Env => :Env1\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_2),\n :FakeWSK => [\n {\n :Input => '01_Source/Record/Env1.2.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env1.2.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env1.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'FFT',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'FFT/Env1.Silence.fftprofile' => 'fft.result' }\n },\n {\n :Input => '01_Source/Record/Env1.Silence.wav',\n :Output => /^.*\\/Dummy\\.wav$/,\n :Action => 'Analyze',\n :UseWave => 'Empty.wav',\n :CopyFiles => { 'Analysis/Env1.Silence.analyze' => 'analyze.result' }\n },\n {\n :Input => '01_Source/Record/Env1.2.wav',\n :Output => '02_Clean/Record/Env1.2.01.SilenceRemover.wav',\n :Action => 'SilenceRemover',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0', '--release', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Env1.2.01.SilenceRemover.wav'\n },\n {\n :Input => '02_Clean/Record/Env1.2.01.SilenceRemover.wav',\n :Output => '02_Clean/Record/Env1.2.04.NoiseGate.wav',\n :Action => 'NoiseGate',\n :Params => [ '--silencethreshold', '-3602,3609', '--attack', '0.1s', '--release', '0.1s', '--silencemin', '1s', '--noisefft', 'Analyze/Record/Env1.Silence.fftprofile' ],\n :UseWave => '02_Clean/Record/Env1.2.04.NoiseGate.wav'\n }\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert File.exists?('Analyze/Record/Env1.2.analyze')\n assert File.exists?('Analyze/Record/Env1.Silence.analyze')\n assert File.exists?('Analyze/Record/Env1.Silence.fftprofile')\n assert File.exists?('02_Clean/Record/Env1.2.01.SilenceRemover.wav')\n assert !File.exists?('02_Clean/Record/Env1.2.02.Cut.0.01s_0.16s.wav')\n assert !File.exists?('02_Clean/Record/Env1.2.03.DCShifter.wav')\n assert File.exists?('02_Clean/Record/Env1.2.04.NoiseGate.wav')\n end\n end",
"def update_offset\n @offset_counter[1] += 0.01\n @offset_counter[1]=@offset_counter[1]%90\n @offset[1] = 30*Math.sin(@offset_counter[1]);\n @offset_counter[0]+=0.005\n @offset_counter[0]=@offset_counter[0]%90\n @offset[0] = 150*Math.sin(@offset_counter[0]);\n # @offset=[0,0]\n end",
"def mix\n #future code\n end",
"def testReuseMixWithAlias\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Mix1' => {\n :Tracks => {\n 'Wave.wav' => {}\n },\n :Alias => 'First mix'\n },\n 'Final' => {\n :Tracks => {\n 'First mix' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => 'Wave.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Empty', '05_Mix/Final/Mix1.wav'\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end",
"def fullmix(in_file,\n start = 0.0,\n outdur = nil,\n inbeg = 0.0,\n matrix = nil,\n srate = nil,\n reverb_amount = 0.05)\n assert_type(File.exists?(in_file), in_file, 0, \"an existing file\")\n dur = Float((outdur or (ws_duration(in_file) / Float((srate or 1.0)).abs)))\n in_chans = ws_channels(in_file)\n inloc = (Float(inbeg) * ws_srate(in_file)).round\n mx = file = envs = rev_mx = revframe = false\n if srate\n file = make_array(in_chans) do |chn|\n make_ws_reader(in_file, :start, inloc, :channel, chn)\n end\n else\n file = in_file\n end\n mx = if matrix\n make_mixer([in_chans, @channels].max)\n else\n make_scalar_mixer([in_chans, @channels].max, 1.0)\n end\n if @ws_reverb and reverb_amount.positive?\n rev_mx = make_mixer(in_chans)\n in_chans.times do |chn|\n mixer_set!(rev_mx, chn, 0, reverb_amount)\n end\n revframe = make_frame(1)\n end\n case matrix\n when Array\n in_chans.times do |ichn|\n inlist = matrix[ichn]\n @channels.times do |ochn|\n outn = inlist[ochn]\n case outn\n when Numeric\n mixer_set!(mx, ichn, ochn, outn)\n when Array, Mus\n unless envs\n envs = make_array(in_chans) do\n make_array(@channels, false)\n end\n end\n if env?(outn)\n envs[ichn][ochn] = outn\n else\n envs[ichn][ochn] = make_env(:envelope, outn, :duration, dur)\n end\n else\n Snd.warning(\"unknown element in matrix: %s\", outn.inspect)\n end\n end\n end\n when Numeric\n # matrix is a number in this case (a global scaler)\n in_chans.times do |i|\n if i < @channels\n mixer_set!(mx, i, i, matrix)\n end\n end\n end\n start = Float(start)\n # to satisfy with_sound-option :info and :notehook\n with_sound_info(get_func_name, start, dur)\n run_fullmix(start, dur, in_chans, srate,\n inloc, file, mx, rev_mx, revframe, envs)\n array?(file) and file.each do |rd| close_ws_reader(rd) end\nend",
"def testNormalTrack\n execute_Mix_WithConf({\n :Recordings => {\n :Tracks => {\n [1] => {\n :Env => :Env1\n }\n }\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n [1] => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1, :Cleaned_Env1_1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Env1.1.04.NoiseGate.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert Dir.glob('05_Mix/Env1.1.Calibrated.0.Test.????????????????????????????????.wav').empty?\n assert_wave_lnk '02_Clean/Record/Env1.1.04.NoiseGate', '05_Mix/Final/Final.wav'\n end\n end",
"def testDontOptimizeProcessesOn2Tracks\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave1.wav'\n },\n {\n :Name => 'Wave2.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave1.wav' => {\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '1db'\n }\n ]\n },\n 'Wave2.wav' => {\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '2db'\n }\n ]\n }\n },\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '3db'\n }\n ]\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/01_Source/Wave/Wave1.wav', 'Wave1.wav' ],\n [ 'Wave/01_Source/Wave/Wave2.wav', 'Wave2.wav' ]\n ],\n :FakeWSK => [\n {\n :Input => 'Wave1.wav',\n :Output => /05_Mix\\/Wave1\\.0\\.VolCorrection\\.[[:xdigit:]]{32,32}\\.wav/,\n :Action => 'Multiply',\n :Params => [ '--coeff', '1db' ],\n :UseWave => '05_Mix/Wave1.0.VolCorrection.1db.wav'\n },\n {\n :Input => 'Wave2.wav',\n :Output => /05_Mix\\/Wave2\\.0\\.VolCorrection\\.[[:xdigit:]]{32,32}\\.wav/,\n :Action => 'Multiply',\n :Params => [ '--coeff', '2db' ],\n :UseWave => '05_Mix/Wave2.0.VolCorrection.2db.wav'\n },\n {\n :Input => /05_Mix\\/Wave1\\.0\\.VolCorrection\\.[[:xdigit:]]{32,32}\\.wav/,\n :Output => /05_Mix\\/Final\\.[[:xdigit:]]{32,32}\\.wav/,\n :Action => 'Mix',\n :Params => [ '--files', /05_Mix\\/Wave2\\.0\\.VolCorrection\\.[[:xdigit:]]{32,32}\\.wav\\|1/ ],\n :UseWave => '05_Mix/Wave1.1db.Wave2.2db.wav'\n },\n {\n :Input => /05_Mix\\/Final\\.[[:xdigit:]]{32,32}\\.wav/,\n :Output => /05_Mix\\/Final\\.0\\.VolCorrection\\.[[:xdigit:]]{32,32}\\.wav/,\n :Action => 'Multiply',\n :Params => [ '--coeff', '3db' ],\n :UseWave => '05_Mix/Wave1.1db.Wave2.2db.3db.wav'\n }\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n getFileFromGlob('05_Mix/Wave1.0.VolCorrection.????????????????????????????????.wav')\n getFileFromGlob('05_Mix/Wave2.0.VolCorrection.????????????????????????????????.wav')\n getFileFromGlob('05_Mix/Final.????????????????????????????????.wav')\n getFileFromGlob('05_Mix/Final.0.VolCorrection.????????????????????????????????.wav')\n assert_wave_lnk '05_Mix/Wave1.1db.Wave2.2db.3db', '05_Mix/Final/Final.wav'\n end\n end",
"def pqw(start, dur, spacing_freq, carrier_freq,\n amp, ampfun, indexfun, partials, *args)\n degree, distance, reverb_amount = nil\n optkey(args, binding,\n [:degree, 0.0],\n [:distance, 1.0],\n [:reverb_amount, 0.005])\n normalized_partials = normalize_partials(partials)\n spacing_cos = make_oscil(:frequency, spacing_freq, :initial_phase, HALF_PI)\n spacing_sin = make_oscil(:frequency, spacing_freq)\n carrier_cos = make_oscil(:frequency, carrier_freq, :initial_phase, HALF_PI)\n carrier_sin = make_oscil(:frequency, carrier_freq)\n sin_coeffs = partials2polynomial(normalized_partials, 0)\n cos_coeffs = partials2polynomial(normalized_partials, 1)\n amp_env = make_env(:envelope, ampfun, :scaler, amp, :duration, dur)\n ind_env = make_env(:envelope, indexfun, :duration, dur)\n r = carrier_freq / spacing_freq.to_f\n tr = make_triangle_wave(:frequency, 5,\n :amplitude, hz2radians(0.005 * spacing_freq))\n rn = make_rand_interp(:frequency, 12,\n :amplitude, hz2radians(0.005 * spacing_freq))\n run_instrument(start, dur,\n :degree, degree,\n :distance, distance,\n :reverb_amount, reverb_amount) do\n vib = triangle_wave(tr) + rand_interp(rn)\n ax = [1.0, env(ind_env)].min * oscil(spacing_cos, vib)\n fax = polynomial(cos_coeffs, ax)\n yfax = oscil(spacing_sin, vib) * polynomial(sin_coeffs, ax)\n env(amp_env) *\n (oscil(carrier_sin, vib * r) * yfax -\n oscil(carrier_cos, vib * r) * fax)\n end\nend",
"def set_mix\n @mix = Mix.find(params[:id])\n end",
"def trim_silence\n AudioFile.new(Audio.trim_silence(0.03, 0.1, @audio))\n end",
"def mouse_moved\n modulate_amount = map1d(mouse_y, (0..height), (220..1))\n modulate_frequency = map1d(mouse_x, (0..width), (0.1..100)) \n fm.frequency.set_last_value(modulate_frequency )\n fm.amplitude.set_last_value(modulate_amount)\nend",
"def phase_shift? ; false ; end",
"def testOptimizeProcessesOn1Track\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave1.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave1.wav' => {\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '1db'\n }\n ]\n }\n },\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '2db'\n }\n ]\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/01_Source/Wave/Wave1.wav', 'Wave1.wav' ]\n ],\n :FakeWSK => [\n {\n :Input => 'Wave1.wav',\n :Output => /05_Mix\\/Wave1\\.0\\.VolCorrection\\.[[:xdigit:]]{32,32}\\.wav/,\n :Action => 'Multiply',\n :Params => [ '--coeff', '3.0db' ],\n :UseWave => '05_Mix/Wave1.0.VolCorrection.3db.wav'\n }\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n getFileFromGlob('05_Mix/Wave1.0.VolCorrection.????????????????????????????????.wav')\n assert_wave_lnk '05_Mix/Wave1.0.VolCorrection.3db', '05_Mix/Final/Final.wav'\n end\n end",
"def trim_silence!\n @audio = Audio.trim_silence(0.03, 0.1, @audio)\n nil\n end",
"def test_part1\n seed = [0, 1, 0, -1]\n signal = '59775675999083203307460316227239534744196788252810996056267313158415747954523514450220630777434694464147859581700598049220155996171361500188470573584309935232530483361639265796594588423475377664322506657596419440442622029687655170723364080344399753761821561397734310612361082481766777063437812858875338922334089288117184890884363091417446200960308625363997089394409607215164553325263177638484872071167142885096660905078567883997320316971939560903959842723210017598426984179521683810628956529638813221927079630736290924180307474765551066444888559156901159193212333302170502387548724998221103376187508278234838899434485116047387731626309521488967864391'.each_char.map(&:to_i)\n\n result = signal\n patterns = fft_patterns(signal, seed)\n 100.times do\n result = fft_phase(result, patterns)\n end\n assert_equal [2, 5, 1, 3, 1, 1, 2, 8], result[0..7] # <- correct\n # 25131128\n end",
"def wave\n [*0..60].map do |e|\n (4095 * Math.sin(e * Math::PI / 60)).round\n end\nend",
"def transform\n raise \"No input data\" unless @data\n ([email protected]).each do |k|\n @data.each_with_index do |d,i|\n @freq[k] = Complex(\n @freq[k].real + d * Math.cos( 2 * Math::PI * k * i / @data.size ),\n @freq[k].imag - d * Math.sin( 2 * Math::PI * k * i / @data.size )\n )\n end\n end\n return @freq\n end",
"def set_mix\n @mix = Mix.find(params[:id])\n end",
"def testNormalTrackWithSingleAlias\n execute_Mix_WithConf({\n :Recordings => {\n :Tracks => {\n [1] => {\n :Env => :Env1,\n :Alias => 'Track 1'\n }\n }\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Track 1' => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Recorded_Env1_1, :Cleaned_Env1_1)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Env1.1.04.NoiseGate.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => '02_Clean/Record/Env1.1.04.NoiseGate.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert Dir.glob('05_Mix/Env1.1.Calibrated.0.Test.????????????????????????????????.wav').empty?\n assert_wave_lnk '02_Clean/Record/Env1.1.04.NoiseGate', '05_Mix/Final/Final.wav'\n end\n end",
"def pins(start, dur, file, amp, *args)\n assert_type(File.exists?(file), file, 2, \"an existing file\")\n transposition, time_scaler, fftsize, highest_bin, max_peaks, attack = nil\n optkey(args, binding,\n [:transposition, 1.0], # this can be used to transpose the sound\n [:time_scaler, 1.0], # this can make things happen faster\n # (< 1.0)/slower (> 1.0) in the output\n [:fftsize, 256], # should be a power of 2\n # at 22050 srate, this is ok for\n # sounds above 300Hz or so, below that\n # you need 512 or 1024, at 44100,\n # probably best to double these sizes\n # -- it takes some searching\n # sometimes.\n [:highest_bin, 128], # how high in fft data should we search for pks\n [:max_peaks, 16], # how many spectral peaks to track at the max\n :attack) # whether to use original attack via time domain\n # splice do the sliding fft shuffle,\n # translate to polar coordinates, find\n # spectral peaks, match with current,\n # do some interesting transformation,\n # resynthesize using oscils All the\n # envelopes are created on the fly.\n # max-peaks is how many of these peaks\n # we are willing to track at any given\n # time.\n fil = make_file2sample(file)\n file_duration = ws_duration(file)\n fdr = make_vct(fftsize)\n fdi = make_vct(fftsize)\n window = make_fft_window(Blackman2_window, fftsize)\n fftamps = make_vct(fftsize)\n max_oscils = 2 * max_peaks\n current_peak_freqs = make_vct(max_oscils)\n last_peak_freqs = make_vct(max_oscils)\n current_peak_amps = make_vct(max_oscils)\n last_peak_amps = make_vct(max_oscils)\n peak_amps = make_vct(max_peaks)\n peak_freqs = make_vct(max_peaks)\n resynth_oscils = make_array(max_oscils) do make_oscil(:frequency, 0) end\n # run-time generated amplitude and frequency envelopes\n amps = make_vct(max_oscils)\n rates = make_vct(max_oscils)\n freqs = make_vct(max_oscils)\n sweeps = make_vct(max_oscils)\n lowest_magnitude = 0.001\n hop = (fftsize / 4).floor\n outhop = (time_scaler * hop).floor\n ifreq = 1.0 / outhop\n ihifreq = hz2radians(ifreq)\n # integrate Blackman-Harris window = .42323*window\n fftscale = 1.0 / (fftsize * 0.42323)\n # width and shift by fftsize\n fft_mag = @srate / fftsize\n furthest_away_accepted = 0.1\n filptr = 0\n cur_oscils = max_oscils\n ramped = (attack or 0)\n splice_attack = attack.kind_of?(Numeric)\n attack_size = (attack or 1)\n ramp_ind = 0\n ramped_attack = make_vct(attack_size)\n if (dur / time_scaler) > file_duration\n error(\"%s is %1.3f seconds long, \\\nbut we'll need %1.3f seconds of data for this note\",\n file, file_duration, dur / time_scaler)\n end\n trigger = outhop\n vct_scale!(window, fftscale)\n run_instrument(start, dur) do\n if splice_attack\n ramp = 1.0 / attack_size\n # my experience in translating SMS, and rumor via Greg Sandell\n # leads me to believe that there is in fact no way to model some\n # attacks successfully in this manner, so this block simply\n # splices the original attack on to the rest of the note.\n # \"attack\" is the number of samples to include bodily.\n out_val = amp * file2sample(fil, filptr)\n filptr += 1\n if filptr > attack_size\n mult = 1.0\n attack_size.times do |j|\n ramped_attack[j] = mult * file2sample(fil, filptr + j)\n mult -= ramp\n end\n splice_attack = false\n end\n # if out_val\n out_val\n else\n if trigger >= outhop\n peaks = 0\n # get next block of data and apply window to it\n trigger = 0\n fftsize.times do |j|\n fdr[j] = window[j] * file2sample(fil, filptr)\n filptr += 1\n end\n vct_fill!(fdi, 0.0)\n filptr -= fftsize - hop\n # get the fft\n mus_fft(fdr, fdi, fftsize, 1)\n # change to polar coordinates (ignoring phases)\n highest_bin.times do |j|\n # no need to paw through the upper half\n # (so (<= highest-bin (floor fft-size 2)))\n x = fdr[j]\n y = fdi[j]\n fftamps[j] = 2.0 * sqrt(x * x + y * y)\n end\n max_oscils.times do |j|\n last_peak_freqs[j] = current_peak_freqs[j]\n last_peak_amps[j] = current_peak_amps[j]\n current_peak_amps[j] = 0.0\n end\n vct_fill!(peak_amps, 0.0)\n ra = fftamps[0]\n la = ca = 0.0\n # search for current peaks following Xavier Serra's recommendations in\n # \"A System for Sound Analysis/Transformation/Synthesis \n # Based on a Deterministic Plus Stochastic Decomposition\"\n highest_bin.times do |j|\n la, ca, ra = ca, ra, fftamps[j]\n if ca > lowest_magnitude and ca > ra and ca > la\n # found a local maximum above the current threshold\n # (its bin number is j-1)\n logla = log10(la)\n logca = log10(ca)\n logra = log10(ra)\n offset = (0.5 * (logla - logra)) / (logla + -2 * logca + logra)\n amp_1 = 10.0 ** (logca - (0.25 * (logla - logra) * offset))\n freq = fft_mag * (j + offset - 1)\n if peaks == max_peaks\n # gotta either flush this peak,\n # or find current lowest and flush him\n minp = 0\n minpeak = peak_amps[0]\n 1.upto(max_peaks - 1) do |k|\n if peak_amps[k] < minpeak\n minp = k\n minpeak = peak_amps[k]\n end\n end\n if amp_1 > minpeak\n peak_freqs[minp] = freq\n peak_amps[minp] = amp_1\n end\n else\n peak_freqs[peaks] = freq\n peak_amps[peaks] = amp_1\n peaks += 1\n end\n end\n end\n # now we have the current peaks -- match them to the previous\n # set and do something interesting with the result the end\n # results are reflected in the updated values in the rates and\n # sweeps arrays. search for fits between last and current,\n # set rates/sweeps for those found try to go by largest amp\n # first\n peaks.times do |j|\n maxp = 0\n maxpk = peak_amps[0]\n 1.upto(max_peaks - 1) do |k|\n if peak_amps[k] > maxpk\n maxp = k\n maxpk = peak_amps[k]\n end\n end\n # now maxp points to next largest unmatched peak\n if maxpk > 0.0\n closestp = -1\n closestamp = 10.0\n current_freq = peak_freqs[maxp]\n icf = 1.0 / current_freq\n max_peaks.times do |k|\n if last_peak_amps[k] > 0.0\n closeness = icf * (last_peak_freqs[k] - current_freq).abs\n if closeness < closestamp\n closestamp = closeness\n closestp = k\n end\n end\n end\n if closestamp < furthest_away_accepted\n # peak_amp is transferred to appropriate current_amp and zeroed,\n current_peak_amps[closestp] = peak_amps[maxp]\n peak_amps[maxp] = 0.0\n current_peak_freqs[closestp] = current_freq\n end\n end\n end\n max_peaks.times do |j|\n if peak_amps[j] > 0.0\n # find a place for a new oscil and start it up\n new_place = -1\n max_oscils.times do |k|\n if last_peak_amps[k].zero? and current_peak_amps[k].zero?\n new_place = k\n break\n end\n end\n current_peak_amps[new_place] = peak_amps[j]\n peak_amps[j] = 0.0\n current_peak_freqs[new_place] = peak_freqs[j]\n last_peak_freqs[new_place] = peak_freqs[j]\n set_mus_frequency(resynth_oscils[new_place],\n transposition * peak_freqs[j])\n end\n end\n cur_oscils = 0\n max_oscils.times do |j|\n rates[j] = ifreq * (current_peak_amps[j] - last_peak_amps[j])\n if current_peak_amps[j].nonzero? or last_peak_amps[j].nonzero?\n cur_oscils = j\n end\n sweeps[j] = ihifreq * transposition *\n (current_peak_freqs[j] - last_peak_freqs[j])\n end\n cur_oscils += 1\n end\n # run oscils, update envelopes\n trigger += 1\n if ramped.zero?\n sum = 0.0\n else\n sum = ramped_attack[ramp_ind]\n ramp_ind += 1\n ramped = 0 if ramp_ind == ramped\n end\n cur_oscils.times do |j|\n if amps[j].nonzero? or rates[j].nonzero?\n sum = sum + amps[j] * oscil(resynth_oscils[j], freqs[j])\n amps[j] += rates[j]\n freqs[j] += sweeps[j]\n end\n end\n # else out_val\n amp * sum\n end\n end\n mus_close(fil)\nend",
"def scale_mixes(mix_list, scl)\n as_one_edit_rb(get_func_name) do\n mix_list.each do |m|\n set_mix_amp(m, scl * mix_amp(m))\n end\n end\n end",
"def phase; end",
"def mutation( orig, track )\n mutant = orig.clone\n filtered_track = track.find_all { |node| @grammar[ node.symbol ].sn_altering == filter }\n return mutant if filtered_track.empty?\n where = @random.rand( filtered_track.size )\n index = ( filtered_track[where].from + @offset ).divmod( mutant.size ).last\n mutant[ index ] = get_codon_value( mutant, index )\n mutant\n end",
"def mov_macros_2b(amp=0.1)\n use_bpm 70\n with_fx :level, amp: amp do\n in_thread do\n 2.times do |i|\n sample :bd_haus, rate: 1 - 0.25 * i, amp: 5\n sample :bd_klub, rate: 1 - 0.25 * i, amp: 5\n n = [2, 4, 8].choose\n pan = rrand(-1, 0)\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :elec_soft_kick, pan: pan, rate: 1, amp: 1\n end\n sleep 0.25\n\n sleep 0.125\n # play chord(:f2, :major), amp: 3 * i, release: 0.25\n sample :bd_haus, rate: 1 - 0.25 * i, amp: 5\n sleep 0.125\n\n n = [3, 4, 8].choose\n with_fx :echo, phase: 0.5 / n, mix: 0.1 do\n sample :elec_soft_kick, rate: 1, amp: 2\n end\n sleep 0.25\n\n sample :bd_haus, rate: 1 - 0.25 * i, amp: 2\n n = [4, 4, 4, 8].choose\n pan = 0\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :elec_soft_kick, pan: pan, rate: 1, amp: 2\n # sample :elec_triangle\n end\n sleep 0.25\n end\n end\n end\nend",
"def in samples\n # CoreAudio range of -32767..32767 makes easy conversion to -1.0..1.0\n if @input_channels == 1\n @input_buf.read(samples)[@input[0],true].to_f.div!(32767)\n else\n b = @input_buf.read samples\n c_out = NArray.scomplex samples\n c_out[0..-1] = b[@input[0],true].to_f.div!(32767)\n c_out.imag = b[@input[1],true].to_f.div!(32767)\n c_out\n end\n end",
"def f(phase, var)\n A + (B * Math.sin(phase + (D * var)))\nend",
"def combine_tracks_from_origin\n begin\n tracks = \"\"\n offsets = []\n # This is disgusting, but I want to get this concept working\n # and my brain isn't cooperating. I'm trying to account for\n # any tracks that both have offsets by subtracting the lower offset\n # from the higher one, and reassigning the higher one with the new value\n # and setting the lower one to 0. That way there are no pauses before the track begins\n os = origins.sort_by(&:offset).reverse\n os.each {|o| offsets << o.offset}\n os.first.offset = offsets[0] - offsets[1]\n os.last.offset = 0\n os.each do |o|\n unless File.exist?(o.jingle.latest_path)\n sox_logger.info(\"#{o.jingle.latest_path} does not exist.\")\n raise Errno::ENOENT, \"#{o.jingle.latest_path} not processed yet\"\n end\n sox_logger.info(\"Added track: #{o.jingle.latest_path}\")\n if o.offset > 0\n tracks += (\" -v 0.8 \" + o.jingle.latest_path + \" -p pad \" + o.offset.to_s + \" 0 | sox - -m\")\n elsif o.offset == 0\n #tracks += (\" -v 1 \" + o.jingle.latest_path + \" pad \" + o.offset.to_s + \" 0 | sox - -m\")\n tracks += (\" -v 0.8 \" + o.jingle.latest_path)\n end\n end\n output = assets_path\n #tracks = tracks[0..-11] # Remove the trailing command\n puts \"sox #{tracks} #{output}original.mp3\"\n m = os.first.offset == 0 ? \"-m \" : \"\"\n result = `sox #{m}#{tracks} #{output}original.mp3`\n duration = `soxi -D #{output}original.mp3`\n stat_data = `soxi #{output}original.mp3`\n # TO FIX\n # Stat data with non-UTF-8 stuff won't save in the DB.\n #stat_data = `sox #{output}original.mp3 -n stat`\n update_attributes(\n track_duration: duration,\n state: \"complete\",\n track_file_name: \"origin.mp3\",\n track_content_type: \"audio/mpeg\",\n track_file_size: (File.size(\"#{output}original.mp3\") rescue 0),\n stat: stat_data #.encode(\"UTF-8\").force_encoding('UTF-8')\n )\n rescue => error\n sox_logger.debug(\"Encountered error:\\n\")\n sox_logger.debug($!.backtrace)\n return false\n end\n end",
"def filter(spectrum)\n\t filters.map do |coefficients|\n\t\tcoefficients.zip(spectrum).map {|coefficient, power| coefficient * power }\n\t\t\t\t\t .reduce(&:+)\n\t end\n\tend",
"def testProcessMix\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave.wav' => {}\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => 'Wave.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end",
"def update_tone_change\n return if @tone_duration == 0\n d = @tone_duration\n target = @tone_target\n @tone.red = (@tone.red * (d - 1) + target.red) / d\n @tone.green = (@tone.green * (d - 1) + target.green) / d\n @tone.blue = (@tone.blue * (d - 1) + target.blue) / d\n @tone.gray = (@tone.gray * (d - 1) + target.gray) / d\n @tone_duration -= 1\n end",
"def slow_correction\n slow ? 2000/440 : 1\n end",
"def instrument(midiIn, duration: 1.0, gmBank: \"000\", gmPatch: \"000\", gmPathDir: \"C:/Users/Michael Sutton/Midiloop/default/\", amp: 1.0, attack: 0.01, decay: 0.3, sustain: 0.5, release: 1.0, lpf: 128, hpf: 1, bpm: 60, pan: 0.0, glIn: \"none\", glFunc: \"none\", midiFlag: \"N\") \r\n\r\n #puts \"xgmPathDir: \" + gmPathDir.to_s\r\n if gmPathDir[0] == \"'\"\r\n testPathDir = gmPathDir[1...-1].to_s\r\n #puts \"testPathDir: \" + testPathDir.to_s\r\n #puts \"in 1\"\r\n end\r\n if gmBank[0] == \"'\"\r\n testBank = gmBank[1...-1]\r\n else\r\n testBank = gmBank\r\n end\r\n if gmPatch[0] == \"'\"\r\n testPatch = gmPatch[1...-1]\r\n else\r\n testPatch = gmPatch\r\n end\r\n if gmPathDir[0] == \"'\" \r\n sMixerPresetArray = buildGMSampleArray(testPathDir, testBank, testPatch)\r\n #puts \"using testPathDir\"\r\n else\r\n sMixerPresetArray = buildGMSampleArray(gmPathDir, testBank, testPatch)\r\n end\r\n presetMixerLineForPatch = sMixerPresetArray[0]\r\n presetMixerLineForPatchLength = presetMixerLineForPatch.length\r\n presetSettings = presetMixerLineForPatch[8..presetMixerLineForPatch.length].partition(\",\").last\r\n \r\n sampleToPlay = presetSettings.split(\",\")[7]\r\n if gmPathDir[0] == \"'\" \r\n sampleFileName = gmPathDir + sampleToPlay + \".pisf\"\r\n sampleArray = getSample(sampleFileName, gmPathDir) \r\n else\r\n sampleFileName = gmPathDir + sampleToPlay + \".pisf\"\r\n #puts \"sampleFileName: \" + sampleFileName.to_s\r\n sampleArray = getSample(sampleFileName, gmPathDir) \r\n end\r\n\r\n \r\n if lpf.to_i > 128 # override Frequency is not set so use the FC in the preset file\r\n lpfFreqCutoff = presetSettings.split(\",\")[4].to_f.floor\r\n else\r\n lpfFreqCutoff = lpf\r\n end\r\n if hpf.to_i < 2 # override Frequency is not set so use the FC in the preset file\r\n #hpfFreqCutoff = presetSettings.split(\",\")[4].to_f.floor\r\n hpfFreqCutoff = hpf\r\n else\r\n hpfFreqCutoff = hpf\r\n end\r\n\r\n ### Dead cide\r\n if midiIn.instance_of? Array \r\n if midiIn[0].instance_of? String\r\n midiSamplePlayer gmPathDir, midiIn, sampleArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, glIn, glFunc, midiFlag\r\n end\r\n end\r\n ##### \r\n\r\n if midiIn.instance_of? Symbol\r\n midiArray = []\r\n midiInStr = midiIn\r\n if gmPathDir[0] == \"'\" \r\n samplePlayer midiIn.to_i, duration, testPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n else\r\n samplePlayer midiIn.to_i, duration, gmPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n end\r\n end\r\n if midiIn.kind_of? Integer\r\n if gmPathDir[0] == \"'\"\r\n if midiIn.to_i != -1 \r\n samplePlayer midiIn.to_i, duration, testPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n end\r\n else\r\n if midiIn.to_i != -1\r\n samplePlayer midiIn.to_i, duration, gmPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n end\r\n end\r\n end\r\nend",
"def cas_filter\n RubyCAS::Filter.filter self\n end",
"def compress\n input_len = @input.bytesize\n tmp = optipng(quantize(@input))\n\n # Check to see whether we've improved the situation\n output_len = tmp.bytesize\n if input_len > output_len\n $LOG.debug \" %d bytes -> %d bytes = %.1f%%\" % [ input_len, output_len, 100 * output_len/input_len ] if $LOG.debug?\n @output = tmp\n @modified = true\n else\n $LOG.debug \" no gain\" if $LOG.debug?\n @output = @input\n @modified = false\n end\n self\n end",
"def do_process(audio)\n SPF::Gateway::Audio.identify(audio)\n end",
"def phase_shift? ; @phase_shift ; end",
"def phase(phase, speed)\r\n @phase = phase\r\n @phase_speed = speed\r\n @phase_count = 0\r\n self.opacity = 255\r\n end",
"def sine_wave(delta, now) \n if delta > 100\n _y = 0.40 # tunnel width as a percentage of screen height\n _dy = 0.20 # maximum displacement as a percentage of screen height\n _per = 1000.0 # wave oscillation period in milliseconds\n top_y = @window.height * (0.5 * (1 + _y) + _dy * Math.sin(now/_per))\n bot_y = @window.height * (0.5 * (1 - _y) + _dy * Math.sin(now/_per))\n \n Rock.new(@window, @object_pool, x: @window.width, y: top_y, vel_x: -5, vel_y: 0, ang_vel: rand(-0.5..0.5))\n Rock.new(@window, @object_pool, x: @window.width, y: bot_y, vel_x: -5, vel_y: 0, ang_vel: rand(-0.5..0.5))\n @last_spawn = now\n end\n end",
"def mix_the_mixing_bowl_well\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n value = nil\n mix_the_mixing_bowl_well_start_index = @input.index\n ordinal30 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return value\n end\n # at line 202:5: mix ( ( WS the )? ( WS ordinal )? WS mixing WS bowl )? WS well EOF\n @state.following.push( TOKENS_FOLLOWING_mix_IN_mix_the_mixing_bowl_well_742 )\n mix\n @state.following.pop\n # at line 202:9: ( ( WS the )? ( WS ordinal )? WS mixing WS bowl )?\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == WS )\n look_24_1 = @input.peek( 2 )\n\n if ( look_24_1.between?( ST, TH ) || look_24_1.between?( T__16, T__17 ) || look_24_1.between?( T__40, T__41 ) )\n alt_24 = 1\n end\n end\n case alt_24\n when 1\n # at line 202:10: ( WS the )? ( WS ordinal )? WS mixing WS bowl\n # at line 202:10: ( WS the )?\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0 == WS )\n look_22_1 = @input.peek( 2 )\n\n if ( look_22_1.between?( T__16, T__17 ) )\n alt_22 = 1\n end\n end\n case alt_22\n when 1\n # at line 202:11: WS the\n match( WS, TOKENS_FOLLOWING_WS_IN_mix_the_mixing_bowl_well_746 )\n @state.following.push( TOKENS_FOLLOWING_the_IN_mix_the_mixing_bowl_well_748 )\n the\n @state.following.pop\n\n end\n # at line 202:20: ( WS ordinal )?\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == WS )\n look_23_1 = @input.peek( 2 )\n\n if ( look_23_1.between?( ST, TH ) )\n alt_23 = 1\n end\n end\n case alt_23\n when 1\n # at line 202:21: WS ordinal\n match( WS, TOKENS_FOLLOWING_WS_IN_mix_the_mixing_bowl_well_753 )\n @state.following.push( TOKENS_FOLLOWING_ordinal_IN_mix_the_mixing_bowl_well_755 )\n ordinal30 = ordinal\n @state.following.pop\n\n end\n match( WS, TOKENS_FOLLOWING_WS_IN_mix_the_mixing_bowl_well_759 )\n @state.following.push( TOKENS_FOLLOWING_mixing_IN_mix_the_mixing_bowl_well_761 )\n mixing\n @state.following.pop\n match( WS, TOKENS_FOLLOWING_WS_IN_mix_the_mixing_bowl_well_763 )\n @state.following.push( TOKENS_FOLLOWING_bowl_IN_mix_the_mixing_bowl_well_765 )\n bowl\n @state.following.pop\n\n end\n match( WS, TOKENS_FOLLOWING_WS_IN_mix_the_mixing_bowl_well_769 )\n @state.following.push( TOKENS_FOLLOWING_well_IN_mix_the_mixing_bowl_well_771 )\n well\n @state.following.pop\n match( EOF, TOKENS_FOLLOWING_EOF_IN_mix_the_mixing_bowl_well_773 )\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = {\n :cmd => :mix_the_mixing_bowl_well,\n :args => {:mixing_bowl => ordinal30.to_i}\n }\n \n # <-- action\n end\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 13 )\n memoize( __method__, mix_the_mixing_bowl_well_start_index, success ) if @state.backtracking > 0\n\n end\n \n return value\n end",
"def testReuseMixWithAliasList\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Mix1' => {\n :Tracks => {\n 'Wave.wav' => {}\n },\n :Alias => [ 'First mix', 'Second mix' ]\n },\n 'Final' => {\n :Tracks => {\n 'Second mix' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => 'Wave.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Empty', '05_Mix/Final/Mix1.wav'\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end",
"def smoothed(factor)\n\t\tself.enum_for(:each_slice, factor).map { |snipit| snipit.compact.aaverage }\n\tend",
"def freq_vco(synth)\n f_pfd = freq_pfd(synth)\n int = Valon.get_field(registers(synth), :int)\n frac = Valon.get_field(registers(synth), :frac)\n mod = Valon.get_field(registers(synth), :mod)\n mod = 1 if mod == 0\n f_vco = f_pfd * (int + Rational(frac,mod))\n f_vco.denominator == 1 ? f_vco.to_i : f_vco.denominator\n end",
"def quick_transcode(input, options={})\n quality = options[:quality] || 19\n log = options[:log]\n output = input.gsub(/\\.[^.]*$/, '.m4v')\n\n # TODO Next time this is needed, make the options below detect its use.\n pcm_input = nil\n # extract the audio to PCM with ffmpeg first because sometimes HandBrakeCLI has problems\n # pcm_input = \"#{input}-temp.avi\"\n # command = <<-EOS\n # nice -n 19 ffmpeg -i \"#{input}\" -acodec adpcm_ms -vcodec copy \"#{pcm_input}\"\n # EOS\n # input = pcm_input # we no longer care about the original.\n # command = command.strip\n # # log.info \"Extracting audio to PCM with ffmpeg...\"\n # puts \"Prepping with ffmpeg using: #{command}\"\n # system(command)\n\n # x264opts will be passed to the '-x' argument of HandBrakeCLI\n # I took these from the advanced tab of the HandBrake 0.9.5 x86_64 (2011010300) GUI for the AppleTV preset\n x264opts = {\n :'cabac' => '0',\n :'ref' => '2',\n :'me' => 'umh',\n :'b-pyramid' => 'none',\n :'b-adapt' => '2',\n :'weightb' => '0',\n :'trellis' => '0',\n :'weightp' => '0',\n :'vbv-maxrate' => '9500',\n :'vbv-bufsize' => '9500' }\n\n options = {\n :'-i' => %{\"#{input}\"},\n :'-o' => %{\"#{output}\"},\n :'--crop' => '0:0:0:0',\n :'-X' => '1280',\n :'-Y' => '720',\n :'-e' => 'x264',\n :'-q' => quality,\n :'--loose-anamorphic' => nil,\n :'--markers' => nil, # chapter markers\n :'-x' => x264opts.map{|k,v| \"#{k}=#{v}\"}.join(':') }\n\n # Now transcode the video and re-mux / transcode in the audio extracted by ffmpeg\n command = \"nice -n 19 HandBrakeCLI #{options.map{|k,v| \"#{k} #{v}\"}.join(\" \")}\"\n command = command.gsub(/ +/, ' ').strip\n # puts \"doing it!: #{command}\"\n system(command) # backticks wont work here.\n\n # if we're using the intermediate pcm-audio step, clean up after ourselves.\n if pcm_input\n # log.info \"Cleaning up ffmpeg intermediate step...\"\n File.delete(pcm_input)\n end\n\n if options[:source_type] == \"mkv\"\n mkv_options = []\n mkvoptions[:log] = log if log\n mkv_file = MkvFile.new(source_file, mkv_options)\n ##### TODO extract any chapter info and import it\n\n if mkv_file.subtitles?\n srt_file = mkv_file.export_subtitles_as_srt\n\n ##### Mux the M4V and SRT files\n log.info \"Muxing subtitles into .M4V file '#{m4v_file}' ...\" if log\n `SublerCLI -i \"#{m4v_file}\" -s \"#{srt_file}\"`\n\n mkv_file.cleanup_subtitle_files\n end\n end\nend",
"def solve_amp(phase, signal)\n if @feedback\n program = @program\n else\n program = @program.dup\n end\n opcode = 0\n\n while (opcode != @STOP && pointer < program.length) do \n puts \"pointer: #{pointer}\" if @DEBUG\n opcode = program[pointer]\n a = 0\n b = 0\n c = 0\n\n # Check Immeidate Mode\n if(opcode.to_s.length > 2)\n opcode = opcode.to_s\n # need to parse that fancy code\n instruction = opcode[-2..-1].to_i\n puts \"instruction: #{instruction}\\nopcode: #{opcode}\" if @DEBUG\n \n if (opcode.length == 3)\n puts \"length: 3\" if @DEBUG\n c = opcode[0].to_i\n elsif (opcode.length == 4)\n puts \"length: 4\" if @DEBUG\n b = opcode[0].to_i\n c = opcode[1].to_i\n elsif (opcode.length == 5)\n puts \"length: 5\" if @DEBUG\n a = opcode[0].to_i\n b = opcode[1].to_i\n c = opcode[2].to_i\n end\n else\n puts \"opcode only: #{opcode}\" if @DEBUG\n instruction = opcode.to_i\n end\n\n if(instruction == @STOP)\n puts \"STOP\"\n @stopped = true\n break\n end\n\n puts \"a: #{a}\\nb: #{b}\\nc: #{c}\\n\" if @DEBUG\n \n if(instruction == @ADD || instruction == @MULTIPLY)\n position_a = program[pointer + 1].to_i\n position_a = program[position_a].to_i if c == 0\n\n position_b = program[pointer + 2].to_i\n position_b = program[position_b].to_i if b == 0\n\n position_c = program[pointer + 3].to_i #if a == 0\n #position_c = program[pointer + 3].to_i if a == 1\n \n if(instruction == @ADD)\n program[position_c] = position_a + position_b\n elsif(instruction == @MULTIPLY)\n program[position_c] = position_a * position_b\n end\n pointer += 4\n puts \"incrementing pointer by 4\" if @DEBUG\n end\n\n if(instruction == @READ)\n if (c == 0)\n # puts \"\\nSTATUS: #{program[program[pointer + 1].to_i]}\\n\"\n return program[program[pointer + 1].to_i]\n else\n # puts \"\\nSTATUS: #{program[pointer + 1]}\\n\"\n return program[pointer + 1]\n end\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n if(instruction == @STORE)\n #print \"input: \"\n if @input_times == 0\n number = phase\n @input_times += 1\n else\n number = signal\n end\n target = program[pointer + 1].to_i\n program[target] = number.to_i\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n # only two params\n if(instruction == @JUMP_IF_TRUE)\n puts \"Jump if true\" if @DEBUG\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n unless program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # only two params\n if(instruction == @JUMP_IF_FALSE)\n puts \"Jump if false\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n \n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n if program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # four parameters\n if(instruction == @LESS)\n puts \"Less\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n if(program[first].to_i < program[second].to_i)\n program[third] = 1\n else\n program[third] = 0\n end\n\n pointer += 4\n end\n\n if(instruction == @EQUALS)\n puts \"Equals\" if @DEBUG\n\n first = pointer + 1\n first = program[pointer + 1].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n puts \"first: #{program[first]}, second: #{program[second]}\" if @DEBUG\n\n if(program[first].to_i == program[second].to_i)\n puts \"Setting #{third} to 1\" if @DEBUG\n program[third] = 1\n else\n puts \"Setting #{third} to 0\" if @DEBUG\n program[third] = 0\n end\n\n pointer += 4\n end\n gets if @DEBUG\n end\n end",
"def initialize\n\t\t\t\t@noise_amplitude = 0.0\n\t\t\tend",
"def main_audio ; end",
"def filter_prepare(current_filter = @filter, subfilter = @subfilter)\n verified_filter = @filters.assoc(current_filter) ? current_filter : @filters.first[0]\n subfilter ||= {}\n the_filter = @filters.assoc(verified_filter)[1]\n # I had to do this in this kind of funny way to avoid actually modifying @filters.\n find_conditions = the_filter.has_key?(:conditions) ? the_filter[:conditions].dup : ['1']\n find_include = []\n # find_conditions += filter[:conditions] if filter.has_key?(:conditions)\n find_include += the_filter[:include] if the_filter.has_key?(:include)\n # If no subfilters have been checked, this should be skipped, accept all\n # If some subfilters have been checked, only the checked ones will be traversed.\n # Within a single key, two checks yields OR\n # Across keys, two checks yield AND\n # The idea is that the subfilter conditions will read \"field in (?)\"\n # And then the keys will provide the array of options\n subfilter.each do |key, sf|\n fsf = the_filter[:subfilters].assoc(key)[1].dup\n find_conditions[0] += (' and ' + fsf[:conditions])\n find_conditions << sf.keys\n find_include << fsf[:include] if fsf.has_key?(:include)\n end\n total_records = scoped_model.count(:all, :include => find_include, :conditions => find_conditions)\n # puts \"%%%%% FILTER INFO IN FILTER_PREPARE: include:[#{find_include.inspect}], conditions:[#{find_conditions.inspect}].\"\n return[verified_filter, subfilter, find_include, find_conditions, total_records]\n end",
"def pipet_master_mixes(compositions:, microtiter_plate:)\n compositions.each do |composition|\n pipet_master_mix(\n composition: composition,\n microtiter_plate: microtiter_plate\n )\n end\n end",
"def mix\n (0..@length-1).to_a.map { |index| mix_frame(index) }\n end",
"def rawtransforms(nsamples)\n size = 1.0\n nsplit = nsamples - 1\n rsize = size - nsplit * @mindiff\n if rsize < 0.0\n raise(\"RandomFilter rawtransforms error: nsamples #{nsamples} mindiff #{@mindiff} are incompatible\")\n end\n \n mindiffs = Array.new( nsplit, @mindiff )\n \n # compute now nsplit values whose sum is <= to rsize\n randarray = [0.0]\n subarray = (0.0..rsize).rand( nsplit-1 )\n if not subarray.is_a? Array\n subarray = [subarray]\n end\n randarray += subarray\n randarray.push( rsize )\n randarray.sort!\n\n rsizes = Array.new\n randarray.each_cons(2) { |min, max| rsizes.push( (0.0..max-min).rand ) }\n\n rsum = rsizes.sum\n root = (0.0..(rsize-rsum)).rand\n\n # Trace(\"mindiffs #{mindiffs.inspect} rsizes #{rsizes.inspect} rsize #{rsize} rsum #{rsum} root #{root}\")\n\n preresult = []\n mindiffs.zip( rsizes ) {|mindiff, rsize| preresult.push( mindiff + rsize )}\n\n result = [root]\n preresult.each {|v| newv = result[-1] + v; result << newv }\n\n return result\n end",
"def generateRakeFor_Mix\n if (!@Context[:RakeSetupFor_ProcessSourceFiles])\n generateRakeFor_ProcessSourceFiles\n end\n\n lMixConf = @RecordConf[:Mix]\n if (lMixConf != nil)\n\n # Create a map of all possible TrackIDs, with their corresponding target containing the file name as part of its data\n # map< Object, Symbol >\n lFinalSources = {}\n lRecordingsConf = @RecordConf[:Recordings]\n if (lRecordingsConf != nil)\n lTracksConf = lRecordingsConf[:Tracks]\n if (lTracksConf != nil)\n lTracksConf.each do |iLstTracks, iTrackInfo|\n associateSourceTarget(iLstTracks, iTrackInfo, \"FinalBeforeMix_Recording_#{File.basename(getRecordedFileName(iTrackInfo[:Env], iLstTracks))[0..-5]}\".to_sym, lFinalSources)\n end\n end\n end\n lWaveConf = @RecordConf[:WaveFiles]\n if (lWaveConf != nil)\n lFilesList = lWaveConf[:FilesList]\n if (lFilesList != nil)\n lFilesList.each do |iWaveInfo|\n associateSourceTarget(iWaveInfo[:Name], iWaveInfo, \"FinalBeforeMix_Wave_#{iWaveInfo[:Name]}\".to_sym, lFinalSources)\n end\n end\n end\n lMixConf.each do |iMixName, iMixInfo|\n associateSourceTarget(iMixName, iMixInfo, \"FinalMix_#{iMixName}\".to_sym, lFinalSources)\n end\n log_debug \"List of mix final sources:\\n#{lFinalSources.pretty_inspect}\"\n\n # Use this info to generate needed targets\n lLstTargets = []\n lMixConf.keys.sort.each do |iMixName|\n lLstTargets << generateRakeForMix(iMixName, lFinalSources) if (@Context[:LstMixNames].empty?) or (@Context[:LstMixNames].include?(iMixName))\n end\n\n desc 'Produce all mixes'\n task :Mix => lLstTargets\n\n @Context[:FinalMixSources] = lFinalSources\n end\n\n @Context[:RakeSetupFor_Mix] = true\n end",
"def apply_filter_config\r\n exec(\r\n 'require_once(\"shaper.inc\");',\r\n 'require_once(\"filter.inc\");',\r\n 'filter_configure_sync();'\r\n )\r\n end",
"def mix_params\n params.require(:mix).permit(:name, :length_in_sec, :recorded_at, :description, :source, :music_type, :notes)\n end",
"def upsample_polynomial upsample_factor\n return self.clone.upsample_polynomial!(upsample_factor)\n end",
"def set_songs\n @mix = Mix.find(params[:mix_id])\n end",
"def tick\n count = @uncounted.sum_then_reset# @uncounted = 0 # uncounted.sumThenReset();\n instantRate = count / FIVE_NANOS;\n if @initialized\n oldRate = @rate\n @rate = oldRate + (@alpha * (instantRate - oldRate))\n else \n @rate = instantRate\n @initialized = true\n end\n self\n end",
"def spectral_convolution(spectrum)\n # Convolution of a spectrum by taking all positive differences of masses in the spectrum.\n\n # Spectral Convolution Problem: Compute the convolution of a spectrum.\n # Input: A collection of integers Spectrum.\n # Output: The list of elements in the convolution of Spectrum. If an element has\n # multiplicity k, it should appear exactly k times; you may return the elements in any order.\n spectrum.sort!\n convolution = []\n (1..(spectrum.length-1)).each do |i|\n (i-1).downto(0).each {|j| convolution << (spectrum[i] - spectrum[j])} \n end\n convolution.delete(0)\n return convolution\n end",
"def cross_phase other\n complex2 other, :cross_phase\n end",
"def filter_by_precursor_mass_tolerance!\n pmt = params.peptide_mass_tolerance.to_f\n methd = nil # the method to \n\n case params.peptide_mass_units\n when '0'\n amu_based = true\n milli_amu = false\n when '1'\n amu_based = true\n milli_amu = true\n when '2'\n amu_based = false\n end\n\n self.filtered_by_precursor_mass_tolerance = true\n self.out_files.each do |out_file|\n hits = out_file.hits\n before = hits.size\n hits.reject! do |pep|\n if amu_based\n if milli_amu\n (pep.deltamass.abs > (pmt/1000))\n else\n (pep.deltamass.abs > pmt)\n end\n else\n (pep.ppm.abs > pmt)\n end\n end\n if hits.size != before\n out_file.hits = hits # <- is this necessary \n Mspire::Sequest::Srf::Out::Peptide.update_deltacns_from_xcorr(hits)\n out_file.num_hits = hits.size\n end\n end\n self\n end",
"def analyze\n return unless @cur_fft or @next_fft\n if !@cur_fft_count or @cur_fft_count > @tries\n @cur_fft = @next_fft\n @cur_fft_count = 0\n fft = @cur_fft.dup\n adjust! fft, @phase, @gain\n @cur_fft_best = detect_energies FFTW3::fft(fft)\n else\n @cur_fft_count += 1\n phaseIncrement = @iq_rate * rand_direction\n gainIncrement = @iq_rate * rand_direction\n fft = @cur_fft.dup\n adjust! fft, @phase + phaseIncrement, @gain + gainIncrement\n det = detect_energies FFTW3::fft(fft)\n if det > @cur_fft_best\n @cur_fft_best = det\n @gain += gainIncrement\n @phase += phaseIncrement\n end\n end\n end",
"def lowpass! cutoff_freq, order\n filter = SincFilter.new(:sample_rate => @sample_rate, :order => order, :cutoff_freq => cutoff_freq)\n @data = filter.lowpass(@data)\n return self\n end",
"def trim_p(adc_P)\n var1 = (@calib[:t_fine] >> 1) - 64000\n var2 = (((var1 >> 2) * (var1 >> 2)) >> 11) * @calib[:dig_P6]\n var2 = var2 + ((var1 * @calib[:dig_P5]) << 1)\n var2 = (var2 >> 2) + (@calib[:dig_P4] << 16)\n var1 = (((@calib[:dig_P3] * (((var1 >> 2) * (var1 >> 2)) >> 13)) >> 3) + ((@calib[:dig_P2] * var1) >> 1)) >> 18\n var1 = ((0x8000 + var1) * @calib[:dig_P1]) >> 15\n\n if var1 == 0\n p = 0.0\n else\n p = (0x100000 - adc_P - (var2 >> 12)) * 3125\n p = (p << 1) / var1\n var1 = (@calib[:dig_P9] * ((p >> 3) * (p >> 3)) >> 13) >> 12\n var2 = ((p >> 2) * @calib[:dig_P8]) >> 13\n p = p + ((var1 + var2 + @calib[:dig_P7]) >> 4)\n p /= 100\n end\n end",
"def enable_code_mixing\n @enable_code_mixing.nil? ? true : @enable_code_mixing\n end",
"def enable_code_mixing\n @enable_code_mixing.nil? ? true : @enable_code_mixing\n end",
"def adjustSingleFilter(filter_name)\n\t\tmeth = @methods[filter_name]\n\t\tremove_list = Array.new\n\t\tmeth.getCalls.each do |c|\n\t\t\tif c.getOn.length > 0\n\t\t\t\tc.getOn.each do |on|\n\t\t\t\t\tif @methods[on] == nil\n\t\t\t\t\t\tputs \"Defined #{filter_name} :on => #{on}, but method #{on} is not explicitly defined\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@methods[on].insertCall(c)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tremove_list.push(c)\n\t\t\tend\n\t\tend\n\t\tremove_list.each do |r|\n\t\t\tmeth.getCalls.delete(r)\n\t\tend\n\tend",
"def cosine_al_Sun() \r\n cos( al(@ma, @ta, Celes.faom03(@ta)) ) \r\n end",
"def assemble_master_mix_plate(operation:)\n compositions = operation.temporary[:compositions]\n pp_labels = compositions.map { |c| c.primer_probe_mix.sample.name }\n show_label_mmix_tubes(labels: pp_labels)\n\n group_size = operation.temporary[:options][:group_size]\n program_name = operation.temporary[:options][:program_name]\n\n output_collection = operation.output(PLATE).collection\n output_collection.associate(PRIMER_GROUP_SIZE_KEY, group_size)\n output_collection.associate(COMPOSITION_NAME_KEY, program_name)\n\n make_master_mixes(\n compositions: compositions,\n sample_number: sample_number_with_excess(sample_number: group_size)\n )\n\n microtiter_plate = MicrotiterPlateFactory.build(\n collection: output_collection,\n group_size: group_size,\n method: :cdc_primer_layout\n )\n\n pipet_master_mixes(\n compositions: compositions,\n microtiter_plate: microtiter_plate\n )\n end",
"def vox(start, dur, freq, amp, ampfun, freqfun, freqscl, voxfun, index, vibscl)\n f1 = []\n f2 = []\n f3 = []\n (voxfun.length - 1).step(1, -2) do |i|\n phon = Formants[voxfun[i]]\n x = voxfun[i - 1]\n f1.unshift(phon[0])\n f1.unshift(x)\n f2.unshift(phon[1])\n f2.unshift(x)\n f3.unshift(phon[2])\n f3.unshift(x)\n end\n car_os = make_oscil(:frequency, 0)\n of0 = make_oscil(:frequency, 0)\n of1 = make_oscil(:frequency, 0)\n of2 = make_oscil(:frequency, 0)\n of3 = make_oscil(:frequency, 0)\n of4 = make_oscil(:frequency, 0)\n of5 = make_oscil(:frequency, 0)\n ampf = make_env(:envelope, ampfun, :scaler, amp, :duration, dur)\n frmf1 = make_env(:envelope, f1, :duration, dur)\n frmf2 = make_env(:envelope, f2, :duration, dur)\n frmf3 = make_env(:envelope, f3, :duration, dur)\n freqf = make_env(:envelope, freqfun, :duration, dur, :scaler, freqscl * freq, :offset, freq)\n per_vib = make_triangle_wave(:frequency, 6, :amplitude, freq * vibscl)\n ran_vib = make_rand_interp(:frequency, 20, :amplitude, freq * 0.01)\n run_instrument(start, dur) do\n frq = env(freqf) + triangle_wave(per_vib) + rand_interp(ran_vib)\n car = index * oscil(car_os, hz2radians(frq))\n frm = env(frmf1)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq0 = hz2radians(frm_int * frq)\n frq1 = hz2radians((frm_int + 1) * frq)\n amp1 = frm0 - frm_int\n amp0 = 1.0 - amp1\n else\n frq1 = hz2radians(frm_int * frq)\n frq0 = hz2radians((frm_int + 1) * frq)\n amp0 = frm0 - frm_int\n amp1 = 1.0 - amp0\n end\n frm = env(frmf2)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq2 = hz2radians(frm_int * frq)\n frq3 = hz2radians((frm_int + 1) * frq)\n amp3 = frm0 - frm_int\n amp2 = 1.0 - amp3\n else\n frq3 = hz2radians(frm_int * frq)\n frq2 = hz2radians((frm_int + 1) * frq)\n amp2 = frm0 - frm_int\n amp3 = 1.0 - amp2\n end\n frm = env(frmf3)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq4 = hz2radians(frm_int * frq)\n frq5 = hz2radians((frm_int + 1) * frq)\n amp5 = frm0 - frm_int\n amp4 = 1.0 - amp5\n else\n frq5 = hz2radians(frm_int * frq)\n frq4 = hz2radians((frm_int + 1) * frq)\n amp4 = frm0 - frm_int\n amp5 = 1.0 - amp4\n end\n env(ampf) * (0.8 * (amp0 * oscil(of0, frq0 + 0.2 * car) +\n amp1 * oscil(of1, frq1 + 0.2 * car)) +\n 0.15 * (amp2 * oscil(of2, frq2 + 0.5 * car) +\n amp3 * oscil(of3, frq3 + 0.5 * car)) +\n 0.05 * (amp4 * oscil(of4, frq4 + car) +\n amp5 * oscil(of5, frq5 + car)))\n end\nend",
"def filter(minlen)\n return if skip_step?(@names.get('filter'), 'filtering')\n\n # Only filter input files from Illumina CASAVA 1.8 pipeline\n if `head -n 1 #{@names.get('reads')} | cut -d ' ' -f 3`.empty?\n run_cmd(\n 'fastq_illumina_filter' \\\n \" --keep N -v -l #{minlen} \" \\\n \" -o #{@names.get('filter')}\" \\\n \" #{@names.get('reads')}\"\n )\n else\n @names.set('filter', '.fastq')\n end\n end",
"def process_with_window\r\n @processed_time_data = time_data.take(time_data_size).times self.window.values\r\n self.strategy.data = @processed_time_data\r\n @fft = self.strategy.calculate\r\n @data = @fft\r\n end",
"def upsample_polynomial! upsample_factor\n @data = PolynomialResampling.upsample @data, upsample_factor\n @sample_rate *= upsample_factor\n return self\n end",
"def play_random_clip_fx_random()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$my_sample_volume = 0.2 + rand() * 0.8\n\tif($my_sample_volume > $sample_volume) then\n\t\t$my_sample_volume = $sample_volume\n\tend\n\n\t$my_sample_speed = 0.1 + rand(0.9)\n\t$my_sample_reverse = rand(2) < 1 ? false : true\n\t$my_sample_sampling_rate = 44100\n\t$my_sample_start_pos = 0.0 + rand(0.0..1.0)\n\t$my_sample_phaser = [ rand(2) < 1 ? false : true, \n\t\t\t\t0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$my_sample_flanger = [ rand(2) < 1 ? false : true, \n\t\t\t\t3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$my_sample_reverb = [ rand(2) < 1 ? false : true, \n\t\t\t\t99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n\n\tcmd = \"play -v #{$my_sample_volume * 0.2} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$my_sample_sampling_rate} \"\n\tcmd += \"speed #{$my_sample_speed.round(2)} \"\n\tcmd += \"#{$my_sample_reverse == true ? \"reverse\" : \"\"} \"\n#=begin \n## TODO fix trim\n\tlength = get_sample_length($full_sample_filelist[id])\n\tputs \"l: #{length}\"\n\tputs \"sample_start_pos: #{$my_sample_start_pos}\"\n\tstart_pos = $my_sample_start_pos.round(2) * length.round(2)\n\tstart_pos_HMS = Time.at(start_pos).utc.strftime(\"%H:%M:%S.%L\")\n\tcmd += \"trim =#{start_pos_HMS} \"\n#=end\t\n\tcmd += $my_sample_phaser[0] == true ? \"phaser #{$my_sample_phaser[1].round(2)} #{$my_sample_phaser[2].round(2)} #{$my_sample_phaser[3].round(2)} #{$my_sample_phaser[4].round(2)} #{$my_sample_phaser[5].round(2)} #{$my_sample_phaser[6]} \" : \"\"\n\tcmd += $my_sample_flanger[0] == true ? \"flanger #{$my_sample_flanger[1].round(2)} #{$my_sample_flanger[2].round(2)} #{$my_sample_flanger[3].round(2)} #{$my_sample_flanger[4].round(2)} #{$my_sample_flanger[5].round(2)} #{$my_sample_flanger[6]} #{$my_sample_flanger[7].round(2)} #{$my_sample_flanger[8]} \" : \"\"\n\tcmd += $my_sample_reverb[0] == true ? \"reverb #{$my_sample_reverb[1].round(2)} #{$my_sample_reverb[2].round(2)} #{$my_sample_reverb[3].round(2)} #{$my_sample_reverb[4].round(2)} #{$my_sample_reverb[5].round(2)} #{$my_sample_reverb[6].round(2)} \" : \"\"\n\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n\tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n\t}\n\n }\nend",
"def next_pitch\n @window = @source.next_window\n @sample = @window.sample\n\n shifts = limited_samples.map{|x| x[:index]}\n return nil if shifts.size < 2\n\n # What is this doing?\n @sample.pop( @sample.size - shifts.last )\n @sample.shift( shifts.first )\n shifts.pop\n\n (shifts.size.to_f / @sample.size.to_f) * @window.rate\n end",
"def mix\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n mix_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 337:6: ( 'M' | 'm' ) ( 'I' | 'i' ) ( 'X' | 'x' )\n if @input.peek( 1 ).between?( T__40, T__41 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__58, T__59 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n memoize( __method__, mix_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end",
"def smoothing; end",
"def trim_data\n self.angular_resolution = self.angular_resolution.round(3)\n self.magnitude = self.magnitude.round(3)\n end",
"def merit_self_curve(node, carrier, direction, manager, offset = 0)\n adapter = manager.adapters[node.key]\n\n if adapter.nil?\n raise \"Missing participant for \\\"self: ...\\\" curve: #{node.key}\"\n end\n\n curve = adapter.participant.load_curve\n\n conversion = carrier_to_carrier_conversion(\n node, carrier, direction\n )\n\n filter = merit_curve_value_filter(adapter.config.type, direction)\n\n Qernel::Causality::LazyCurve.new do |frame|\n source_frame = frame - offset\n\n if source_frame.negative?\n 0.0\n elsif filter\n filter.call(curve[source_frame]) * conversion\n else\n curve[source_frame] * conversion\n end\n end\n end",
"def set_crop_mix\n @crop_mix = CropMix.find(params[:id])\n end"
] | [
"0.49873173",
"0.4956558",
"0.47255263",
"0.46772194",
"0.46274573",
"0.4621342",
"0.46030945",
"0.4516759",
"0.44645998",
"0.44560558",
"0.445119",
"0.44385594",
"0.44078064",
"0.44070783",
"0.43946102",
"0.43938574",
"0.43903756",
"0.43463436",
"0.43460736",
"0.43409693",
"0.43334353",
"0.4328222",
"0.43187377",
"0.42673197",
"0.42672917",
"0.4264623",
"0.42587748",
"0.42493162",
"0.4243974",
"0.42287746",
"0.4221391",
"0.42166615",
"0.42117506",
"0.4210555",
"0.42096955",
"0.42071944",
"0.42008165",
"0.41807657",
"0.4139339",
"0.41376796",
"0.41303775",
"0.41301888",
"0.41295925",
"0.4095439",
"0.40940765",
"0.40938166",
"0.4067453",
"0.40606776",
"0.40577194",
"0.40374917",
"0.4021309",
"0.40090868",
"0.40021527",
"0.3990133",
"0.39883196",
"0.39850172",
"0.39663726",
"0.39527887",
"0.3939827",
"0.39088988",
"0.39066985",
"0.39029843",
"0.38948056",
"0.3878907",
"0.38638186",
"0.3861474",
"0.3856201",
"0.38438538",
"0.38393793",
"0.38253418",
"0.382509",
"0.3823456",
"0.38199332",
"0.3811352",
"0.37843743",
"0.3773701",
"0.37728047",
"0.37706712",
"0.37670574",
"0.37660226",
"0.3764878",
"0.37640655",
"0.37589273",
"0.37583885",
"0.3756646",
"0.3756646",
"0.37539956",
"0.37503535",
"0.37482625",
"0.37467876",
"0.37429184",
"0.3739254",
"0.37373483",
"0.37334615",
"0.37256804",
"0.3720765",
"0.37155494",
"0.37105733",
"0.37105164",
"0.3707543"
] | 0.6332244 | 0 |
GET /rounds GET /rounds.json | def index
@rounds = Round.all.order("month DESC")
@rounds = @rounds - [@round]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end",
"def index\n @tournament = Tournament.find(params[:tournament_id])\n @rounds = @tournament.rounds\n end",
"def show\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @game_rounds = current_user.game_rounds\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end",
"def index\n championship = Championship.find_by_desc($current_championship)\n unless championship == nil?\n @rounds = Round.get_all_rounds_by_championship_id(championship.id, params[:page])\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rounds }\n end\n end",
"def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round\") )\n end",
"def index\n @aggregation_rounds = AggregationRound.all\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n @player_rounds = PlayerRound.select(\"id, amount, betValue, player_id, round_id\").where(:round_id => params[:id])\n end",
"def index\n @pmrounds = Pmround.all\n end",
"def show\n @grant_round = GrantRound.find(params[:id])\n\n render json: @grant_round\n end",
"def round_result\n @round = Round.find(params[:id])\n end",
"def index\n @shooting_rounds = ShootingRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_rounds }\n end\n end",
"def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def all_rounds\n generate(User.all)\n render :template => 'chart/index'\n end",
"def play(rounds)\n puts \"\\nThere are #{@players.size} players and \" +\n \"#{TreasureTrove::TREASURES.size} treasures in #{@title}\"\n 1.upto(rounds) do |round|\n puts \"\\nRound #{round}\"\n @players.each do |p|\n GameTurn.take_turn(p)\n end\n end\n end",
"def get_rounds\n puts \"How many rounds?\"\n @rounds = gets.chomp.to_i\n end",
"def request_round\n return auth_err unless auth?\n log \"#{@color} requested a round\"\n return wait_err unless wait_round\n get_map_render\n return game_terminated_msg if game_terminated?\n return {plain: \"continue.\\n\" + @map_render} if plain?\n return {json: {message: \"It's your turn\", map: @map_render, points: @map.took_hash}}\n end",
"def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def each_round\n completed_rounds.each do |r|\n yield [r, @results[r]]\n end\n end",
"def start_rounds\n League.current_seasons.each(&:start_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def index\n @boxscores = @game.boxscores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boxscores }\n end\n end",
"def show\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_round }\n end\n end",
"def index\n unless @level.present?\n redirect_to @user.highest_repetition_level_unlocked.path\n return\n end\n @formatted_round_times = current_user&.round_times_for_level_id(@level.id) || []\n if current_user&.completed_repetition_level?(@level)\n @high_scores = @level.high_scores\n else\n @high_scores = []\n end\n render \"game_modes/repetition\"\n end",
"def recent_rounds\n rounds = []; #return value\n rounds = Round.order(created_at: :desc).limit(30).to_a;\n\n #better make sure this thing is public...\n rounds.reject { |r| r[:status] != GlobalConstants::ROUND_STATUS[:round_started] }\n rounds.shuffle!;\n return rounds[0..2];\n end",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @rockhounds = Rockhound.all\n end",
"def round\n generate(Round.get(params[\"id\"]).participants)\n render :template => 'chart/index'\n end",
"def rounds(n)\n\t\tm1 = self.s1.next(nil)\n\t\tn.times do\n\t\t\tm1 = game(m1)\n\t\tend\n\t\tnumbers = self.scores << self.rp\n\t\tnames = self.hash.keys << :Rounds\n\t\treturn Hash[names.zip(numbers)] \n\tend",
"def index\n @page = params['page'] || 1\n #.with_state(:pending)\n @game_rounds = GameRound.where([\"(state=? OR state=? OR (state=? AND bid_count>0))\",:pending,:started,:success]).includes(:bids).order(\"start_at desc\").paginate(:page => @page)\n\n end",
"def get_rounds_cards\n # get all the cards from this round's deck\n @cards = self.deck.cards\n end",
"def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end",
"def next_rounds\n League.current_seasons.each(&:next_round!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.next_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend",
"def index\n @moves = @game.moves.all\n render json: @moves, status: 200\n end",
"def current_round\r\n self.rounds.last\r\n end",
"def show\n @user = current_user\n @round = Round.find(params[:id])\n @fighter = Fighter.find(@round.fighter_id)\n @score = Score.find_by_user_id(@user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def round( num )\n h = get_matches\n matches = h[ 'rounds' ][ num-1 ] ## note: rounds hash starts with zero (not 1)\n matches\n end",
"def index\n\t\t@runs = @current_user.runs\n\n\t\trender json: @runs\n\tend",
"def show\n #@game.round = @game.rounds.sort_by{|e| e[:place]}\n #@player_stats = @player_stats.sort_by{|e| -e[:wins]}\n end",
"def round_matches(round)\n\t\t@@logger.info { \"Retrieving matches for a given round.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:round => round).all\n\tend",
"def show\n @rounds = set_rounds\n @matches = @competition.matches.select { |match| match.season == @competition.curr_season }\n @matches = @matches.sort_by{ |m| m.round }\n end",
"def show\n @boxscore = @game.boxscores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boxscore }\n end\n end",
"def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successfully created.' end\n format.json { render :show, status: :created, location: @round }\n else\n @form_for = [@tournament, @round]\n format.html do render :new end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def get_rounds\n sparql = SPARQL.parse(\"SELECT DISTINCT ?uri ?label ?time\n WHERE {\n {\n ?uri <#{RDF.type}> <http://www.bbc.co.uk/ontologies/sport/KnockoutCompetition> .\n ?uri <#{RDF::RDFS.label}> ?label .\n ?uri <http://www.bbc.co.uk/ontologies/sport/hasMatch> ?match_uri .\n ?match_uri <http://purl.org/NET/c4dm/event.owl#time> ?time .\n }\n UNION\n {\n ?uri <http://www.bbc.co.uk/ontologies/sport/hasMatch> ?match_uri .\n ?uri <#{RDF::RDFS.label}> ?label .\n ?match_uri <http://purl.org/NET/c4dm/event.owl#time> ?time .\n }\n }\n ORDER BY ASC(?time)\n \")\n results = QUERYABLE.query(sparql)\n end",
"def index\n waiver_picks_decorator = WaiverPicksDecorator.new(\n @fpl_team.waiver_picks.where(round_id: (params[:round_id] || Round.current_round.id))\n )\n\n render json: { waiver_picks: waiver_picks_decorator.all_data }\n end",
"def show\n @game = Game.find(params[:id])\n winner = @game.who_won\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {money: current_user.money.to_i, lost: @game.winner && @game.winner != current_user, won: winner == current_user, my_round: @game.last_player != current_user, blocks:@game.blocks.map{|b| {id: b.id, owner: b.owner ? b.owner.login : nil , left: b.left, right: b.right, up: b.up, down: b.down}} }}\n end\n end",
"def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end",
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n if params[:outcrop_id]\n @rocks = Rock.where(outcrop_id: params[:outcrop_id])\n .paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rocks\n else\n @rocks = Rock.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rocks\n end\n end",
"def get_games_json bracket_json\n return_data = Array.new\n\n bracket_json[\"game_and_pick_list\"][\"regions\"].each do |region|\n region[\"rounds\"].each do |round|\n round[\"games\"].each { |game| return_data << game }\n end\n end\n\n return_data\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def show\n @shooting_round = ShootingRound.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shooting_round }\n end\n end",
"def index\n @turns = Turn.all\n\t\trespond_with @turns\n end",
"def destroy\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to game_rounds_url(@game), notice: 'Round was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def scrape\n\t\n\t\t\n\t\tplayer = params[:player]\n\t\turl = params[:url]\n\t\tendDate = params[:EndDate]\n\t\tfiller = '&GameType=all&PlayedFor=0&PlayedVs=0&Park=0&PlayerID='\n\t\t\t\n\t\tid = Player.find_by_name(player).number.to_s\n\t\tfullUrl = url + '&EndDate=' + endDate + filler + id\n\t\t\n\t\tpage = Nokogiri::HTML(open(fullUrl))\n\t\t\n\t\ttotalsArray = getTotals(page)\n\t\t\n\t\trender :text => totalsArray.to_json()\n\tend",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def total_rounds\n matches_per_round = users.count / 2\n total_matches = (users.count - 1) * matches_per_round\n total_rounds = total_matches / matches_per_round\n\n total_rounds\n end",
"def print_round_results\n @view.print_score_results(@player.hand_value, @dealer.hand_value)\n @view.print_blackjack if @player.blackjack? && player_wins_round?\n if player_wins_round?\n @view.print_player_win\n elsif tie?\n @view.print_tie\n else\n @view.print_player_loss\n end\n end",
"def index\n @winning_numbers = WinningNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winning_numbers }\n end\n end",
"def total_rounds\n self.count_wins + self.count_losses\n end",
"def show\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_round_loan }\n end\n end",
"def my_rounds\n my_rounds = FundingRound.all.select{|rounds| rounds.startup == self}\n end",
"def build_rounds\n round_builder.build\n end",
"def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end",
"def create_rounds(game_ids)\n rounds = [[game_ids[game_ids.length - 4],\n game_ids[game_ids.length - 3],\n game_ids[game_ids.length - 2],\n game_ids[game_ids.length - 1]]]\n\n current_game_index = 0\n num_games_in_round = Bracket::NUM_TEAMS / 2\n final_game_index = current_game_index + (num_games_in_round - 1)\n while num_games_in_round >= 1\n rounds.push([])\n current_game_index.upto(final_game_index) do |game_index|\n rounds.last.push(game_ids[game_index])\n end\n num_games_in_round /= 2\n current_game_index = final_game_index + 1\n final_game_index = current_game_index + (num_games_in_round - 1)\n end\n\n rounds\n end",
"def show\n @round = @season.rounds.find(params[:id])\n\n if @round.published || signed_in_as_admin?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n else\n redirect_to season_path(@round.season)\n end\n end",
"def get_win_rates(load_file)\n data = JSON.parse(File.open(\"#{load_file}\", \"r\").read) # Parse the json into an array\n deck_1_number_wins = 0\n deck_2_number_wins = 0 \n deck_1_win_rate = 0.0\n deck_2_win_rate = 0.0\n \n # Get the total number of times each player won\n data.each do |item|\n if item['random_winner'] == 'Deck_1' \n deck_1_number_wins = deck_1_number_wins +1\n else\n deck_2_number_wins = deck_2_number_wins +1\n end\n end\n \n # Calculate win % and conver that number to a float\n deck_1_win_rate = deck_1_number_wins/data.size.to_f * 100\n deck_2_win_rate = deck_2_number_wins/data.size.to_f * 100\n \n puts \"Deck 1 wins #{deck_1_number_wins}/#{data.size} which is #{deck_1_win_rate}%\"\n puts \"Deck 2 wins #{deck_2_number_wins}/#{data.size} which is #{deck_2_win_rate}%\"\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def round_params\n params.require(:round).permit(:deck_id, :username, :score)\n end",
"def round_params\n params.require(:round).permit(:game_id)\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_all_match_rounds(mid)\n all_rounds.select { |round| round.match_id == mid }\n end",
"def get_pay_runs(options = {})\n request_params = {}\n response_xml = http_get(client, \"#{@payroll_url}/PayRuns\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/pay_runs'})\n end",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def get_round_id\n round_id = @@curr_round[public_user.difficulty_level_id]\n end",
"def create\n @game_round = GameRound.new(game_round_params)\n\n respond_to do |format|\n if @game_round.save\n format.html { redirect_to @game_round, notice: 'Game round was successfully created.' }\n format.json { render :show, status: :created, location: @game_round }\n else\n format.html { render :new }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.8179578",
"0.7259982",
"0.7259982",
"0.7259982",
"0.7259982",
"0.7259982",
"0.7259982",
"0.7259982",
"0.7138636",
"0.7110566",
"0.69381267",
"0.69308823",
"0.69218105",
"0.6695108",
"0.6681436",
"0.66559047",
"0.6504946",
"0.6480924",
"0.6423685",
"0.64184344",
"0.6388241",
"0.6317415",
"0.6298387",
"0.6298288",
"0.62912875",
"0.6209922",
"0.61707854",
"0.6115698",
"0.60917765",
"0.608883",
"0.5994273",
"0.5924034",
"0.5881729",
"0.5878015",
"0.5876849",
"0.5827835",
"0.58205605",
"0.5805892",
"0.5797715",
"0.5781318",
"0.573659",
"0.5732515",
"0.5723126",
"0.5718076",
"0.57086855",
"0.5702155",
"0.56958777",
"0.56939316",
"0.5681326",
"0.5681326",
"0.5673255",
"0.5670374",
"0.56654733",
"0.566543",
"0.56432205",
"0.56114084",
"0.55697954",
"0.55581874",
"0.5531314",
"0.55301744",
"0.55298436",
"0.5528842",
"0.5518684",
"0.5510198",
"0.5492169",
"0.5483669",
"0.5469109",
"0.5455639",
"0.5449699",
"0.54407424",
"0.5439311",
"0.54320997",
"0.5426482",
"0.5426482",
"0.5425288",
"0.54095846",
"0.539556",
"0.539532",
"0.53910214",
"0.53910214",
"0.53910214",
"0.53813106",
"0.5381104",
"0.53800154",
"0.5375821",
"0.53692216",
"0.536682",
"0.5365423",
"0.53605855",
"0.53584445",
"0.5358002",
"0.5357774",
"0.5357721",
"0.5354322",
"0.53426",
"0.53389025",
"0.53372645",
"0.5333023",
"0.53303933",
"0.5324906",
"0.5320933"
] | 0.0 | -1 |
GET /rounds/1 GET /rounds/1.json | def show
@gmaps_links = []
@round.albums.each do |album|
album.places.each do |place|
gmaps_link = place.address + ' ' + place.city + ' ' + place.state
gmaps_link.gsub!(' ', '+')
@gmaps_links << gmaps_link
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend",
"def show\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end",
"def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @tournament = Tournament.find(params[:tournament_id])\n @rounds = @tournament.rounds\n end",
"def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round\") )\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @round }\n end\n end",
"def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end",
"def index\n championship = Championship.find_by_desc($current_championship)\n unless championship == nil?\n @rounds = Round.get_all_rounds_by_championship_id(championship.id, params[:page])\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rounds }\n end\n end",
"def round_result\n @round = Round.find(params[:id])\n end",
"def show\n @grant_round = GrantRound.find(params[:id])\n\n render json: @grant_round\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def index\n @game_rounds = current_user.game_rounds\n end",
"def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end",
"def show\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n @player_rounds = PlayerRound.select(\"id, amount, betValue, player_id, round_id\").where(:round_id => params[:id])\n end",
"def request_round\n return auth_err unless auth?\n log \"#{@color} requested a round\"\n return wait_err unless wait_round\n get_map_render\n return game_terminated_msg if game_terminated?\n return {plain: \"continue.\\n\" + @map_render} if plain?\n return {json: {message: \"It's your turn\", map: @map_render, points: @map.took_hash}}\n end",
"def index\n @shooting_rounds = ShootingRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_rounds }\n end\n end",
"def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def index\n @pmrounds = Pmround.all\n end",
"def current_round\r\n self.rounds.last\r\n end",
"def index\n @aggregation_rounds = AggregationRound.all\n end",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_rounds\n puts \"How many rounds?\"\n @rounds = gets.chomp.to_i\n end",
"def show\n @user = current_user\n @round = Round.find(params[:id])\n @fighter = Fighter.find(@round.fighter_id)\n @score = Score.find_by_user_id(@user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def show\n @boxscore = @game.boxscores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boxscore }\n end\n end",
"def start_rounds\n League.current_seasons.each(&:start_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @boxscores = @game.boxscores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boxscores }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def play(rounds)\n puts \"\\nThere are #{@players.size} players and \" +\n \"#{TreasureTrove::TREASURES.size} treasures in #{@title}\"\n 1.upto(rounds) do |round|\n puts \"\\nRound #{round}\"\n @players.each do |p|\n GameTurn.take_turn(p)\n end\n end\n end",
"def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"def next_rounds\n League.current_seasons.each(&:next_round!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.next_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def show\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_round_loan }\n end\n end",
"def all_rounds\n generate(User.all)\n render :template => 'chart/index'\n end",
"def show\n @shooting_round = ShootingRound.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shooting_round }\n end\n end",
"def round\n generate(Round.get(params[\"id\"]).participants)\n render :template => 'chart/index'\n end",
"def round( num )\n h = get_matches\n matches = h[ 'rounds' ][ num-1 ] ## note: rounds hash starts with zero (not 1)\n matches\n end",
"def show\n @runway_season = Runway::Season.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runway_season }\n end\n end",
"def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end",
"def get_round_id\n round_id = @@curr_round[public_user.difficulty_level_id]\n end",
"def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successfully created.' end\n format.json { render :show, status: :created, location: @round }\n else\n @form_for = [@tournament, @round]\n format.html do render :new end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @winner = Winner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @winner }\n end\n end",
"def show\n @rock = Rock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rock }\n end\n end",
"def index\n @moves = @game.moves.all\n render json: @moves, status: 200\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n unless @level.present?\n redirect_to @user.highest_repetition_level_unlocked.path\n return\n end\n @formatted_round_times = current_user&.round_times_for_level_id(@level.id) || []\n if current_user&.completed_repetition_level?(@level)\n @high_scores = @level.high_scores\n else\n @high_scores = []\n end\n render \"game_modes/repetition\"\n end",
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def show\n @game = Game.find(params[:id])\n winner = @game.who_won\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {money: current_user.money.to_i, lost: @game.winner && @game.winner != current_user, won: winner == current_user, my_round: @game.last_player != current_user, blocks:@game.blocks.map{|b| {id: b.id, owner: b.owner ? b.owner.login : nil , left: b.left, right: b.right, up: b.up, down: b.down}} }}\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end",
"def show\n @turnover = Turnover.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @turnover }\n end\n end",
"def show\n @rink_league = RinkLeague.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rink_league }\n end\n end",
"def show\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rum }\n end\n end",
"def rounds(n)\n\t\tm1 = self.s1.next(nil)\n\t\tn.times do\n\t\t\tm1 = game(m1)\n\t\tend\n\t\tnumbers = self.scores << self.rp\n\t\tnames = self.hash.keys << :Rounds\n\t\treturn Hash[names.zip(numbers)] \n\tend",
"def show\n render json: Game.find(params[:id])\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @run = Run.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run }\n end\n end",
"def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end",
"def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def show\n @round = @season.rounds.find(params[:id])\n\n if @round.published || signed_in_as_admin?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n else\n redirect_to season_path(@round.season)\n end\n end",
"def show\n @game_instance = GameInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game_instance.to_json(:include => { :squares => { :include => :lines }} ) }\n end\n end",
"def show\n @player_box_score = PlayerBoxScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_box_score }\n end\n end",
"def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def new\n @championships = Championship.all\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @round }\n end\n end",
"def index\n\t\t@runs = @current_user.runs\n\n\t\trender json: @runs\n\tend",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def destroy\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to game_rounds_url(@game), notice: 'Round was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def create\n @tournament = Tournament.find(params[:tournament_id])\n @round = Round.new(round_params)\n @round.tournament_id = @tournament.id\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to tournament_path(@tournament), notice: \"Round was successfully created.\" }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @game = Game.find(params[:id])\n @moves = @game.moves\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @rockhounds = Rockhound.all\n end",
"def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end",
"def show\n @winning_number = WinningNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @winning_number }\n end\n end",
"def each_round\n completed_rounds.each do |r|\n yield [r, @results[r]]\n end\n end",
"def set_round\r\n @round = Round.find(params[:id])\r\n end",
"def get_match_data(match_id)\n # Given a matchId, make an API request for the match data.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matches/#{match_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n sleep(1)\n match_data = JSON.parse(response_string)\nend",
"def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end"
] | [
"0.77348197",
"0.7122272",
"0.6969947",
"0.6969947",
"0.6969947",
"0.6969947",
"0.6969947",
"0.6969947",
"0.6969947",
"0.6902254",
"0.6894596",
"0.68345076",
"0.6825466",
"0.6753058",
"0.67452794",
"0.66507864",
"0.66320896",
"0.6569826",
"0.65155756",
"0.6459604",
"0.6414091",
"0.6409035",
"0.62779427",
"0.62204033",
"0.62097436",
"0.6037584",
"0.6033872",
"0.6028329",
"0.5986699",
"0.5968924",
"0.59372336",
"0.592248",
"0.58490866",
"0.5846356",
"0.5800475",
"0.5795107",
"0.57934326",
"0.57854134",
"0.5779243",
"0.5775429",
"0.5773851",
"0.5766675",
"0.5766675",
"0.5764706",
"0.5758768",
"0.57571954",
"0.5738129",
"0.57351106",
"0.57316035",
"0.57161134",
"0.5712449",
"0.56829363",
"0.5681851",
"0.5681513",
"0.5674743",
"0.56702465",
"0.56624633",
"0.5658351",
"0.56418425",
"0.56330264",
"0.56282026",
"0.5624309",
"0.5624309",
"0.5606355",
"0.55918294",
"0.5591195",
"0.5561906",
"0.5557403",
"0.5557403",
"0.5557403",
"0.55562013",
"0.5540313",
"0.55375654",
"0.5528803",
"0.5520883",
"0.55200744",
"0.5516912",
"0.5508739",
"0.5503358",
"0.5503358",
"0.5495641",
"0.5493378",
"0.54929894",
"0.54923844",
"0.5479779",
"0.5477951",
"0.5477951",
"0.5477951",
"0.54750526",
"0.54745364",
"0.5465627",
"0.5463864",
"0.54587287",
"0.5456289",
"0.545544",
"0.5453075",
"0.5450299",
"0.54448074",
"0.5441883",
"0.54206747",
"0.541959"
] | 0.0 | -1 |
POST /rounds POST /rounds.json | def create
@round = Round.new(round_params)
respond_to do |format|
if @round.save
format.html { redirect_to @round }
format.json { render :show, status: :created, location: @round }
else
format.html { render :new }
format.json { render json: @round.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successfully created.' end\n format.json { render :show, status: :created, location: @round }\n else\n @form_for = [@tournament, @round]\n format.html do render :new end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tournament = Tournament.find(params[:tournament_id])\n @round = Round.new(round_params)\n @round.tournament_id = @tournament.id\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to tournament_path(@tournament), notice: \"Round was successfully created.\" }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(round_params['round'])\n\n respond_to do |format|\n if @round.save\n @round.create_matches\n update_parents(@round)\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tournament = Tournament.new(tournament_params)\n\n @tournament.current_round = 0\n @tournament.state = false\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tournament }\n\n # Create all rounds when tournament is created\n @tournament.round_no.times do |x|\n @round = Round.new\n @round.round_no = x + 1\n @round.tournament_id = @tournament.id\n @round.name = @tournament.name + \" round \" + (x + 1).to_s \n @round.turn_duration = 7\n @round.save\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new()\n \n\n @dateTime = Time.new\n @conservative = isConservative\n @result = resultRulleteBet\n\n @round.dateTime = @dateTime\n @round.conservative = @conservative\n @round.result = @result\n\n \n if @round.save \n addPlayerRound(@round.id)\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @game_round = GameRound.new(game_round_params)\n\n respond_to do |format|\n if @game_round.save\n format.html { redirect_to @game_round, notice: 'Game round was successfully created.' }\n format.json { render :show, status: :created, location: @game_round }\n else\n format.html { render :new }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round.debate }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grant_round = GrantRound.new(grant_round_params(params[:grant_round]))\n\n if @grant_round.save\n render json: @grant_round, status: :created, location: @grant_round\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end",
"def create\n @round = Round.new(round_params)\n @round.started = false\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render action: 'show', status: :created, location: @round }\n else\n format.html { render action: 'new' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to(@round, :notice => 'Round was successfully created.') }\n format.xml { render :xml => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to(@round, :notice => 'Round was successfully created.') }\n format.xml { render :xml => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @aggregation_round = AggregationRound.new(aggregation_round_params)\n\n respond_to do |format|\n if @aggregation_round.save\n format.html { redirect_to @aggregation_round, notice: 'Aggregation round was successfully created.' }\n format.json { render :show, status: :created, location: @aggregation_round }\n else\n format.html { render :new }\n format.json { render json: @aggregation_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_round(round, post_content)\n response = HTTParty.post(\"#{BASE_URL}/contest/#{@api_key}/round/#{round}\", :body => {\"data\" => post_content} )\n end",
"def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def round_params\n params.require(:round).permit(:deck_id, :username, :score)\n end",
"def create\n temp_game = Game.new()\n temp_game.date = game_params[:date].to_date\n temp_game.numplay = game_params[:numplay]\n temp_game.backwards = game_params[:backwards]\n temp_game.notrump = game_params[:notrump]\n temp_game.description = game_params[:description]\n\n puts game_params[:rounds_attributes]\n\n game_params[:rounds_attributes].each do |r|\n puts \"0: \" + r[0]\n puts \"1: \" + r[1][:score]\n # score = r[1][:score]\n # place = r[1][:place]\n # correct = r[1][:correct]\n # asterisk = r[1][:asterisk]\n # player_id = r[1][:player_id]\n myround = Round.new(r[1])\n temp_game.rounds << myround\n end\n\n puts temp_game\n\n message = \"\"\n temp_rounds = temp_game.rounds.sort_by{|e| -e[:score]}\n place = 0\n @game = temp_game\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n @game.rounds << round\n message = message + \" \" + round.player.nickname + \" place set to \" + place.to_s\n end\n\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: message }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:date, :number, :tournament_id)\n end",
"def round_params\n params.require(:round).permit(:debate_id, :round_number, :start_time, :end_time, :status)\n end",
"def round_params\n params.require(:round).permit(:game_id, :score1, :score2, :score3, :score4, :roundtype)\n end",
"def create\n @round = Round.new(round_params)\n @round.save!\n notify_clients\n head :ok\n rescue\n render layout: false, status: :bad_request\n end",
"def build_rounds\n round_builder.build\n end",
"def round_params\n params.require(:round).permit(:game_id)\n end",
"def round_params\n params.permit(:id, round:\n [:roundtype_id, :round_number, :matches, :match_number]\n )\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def create\r\n @round = Round.new(round_params)\r\n\r\n respond_to do |format|\r\n if @round.save\r\n set_rounds_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.created', model: Round.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :new }\r\n format.js { render :new }\r\n end\r\n end\r\n end",
"def round_params\n params.require(:round).permit(:round_no, :name, :about, :turn_duration, :start_date, :vote_date, :calc_date)\n end",
"def round_params\n params.require(:round).permit(:judge_id, :status)\n end",
"def create\n @round = Round.new(params[:round])\n params[:round][:start_date] = Date.strptime(params[:round][:start_date], '%d/%m/%Y').strftime.to_s\n params[:round][:end_date] = Date.strptime(params[:round][:end_date], '%d/%m/%Y').strftime.to_s\n\n if params[:championship][:championship_id] == \"\"\n respond_to do |format|\n flash[:error] = \"Voce deve selecionar o campeonato\"\n format.html { render :action => \"new\" }\n end\n else\n @championship = Championship.find(params[:championship][:championship_id])\n @last_round4_championship = Round.find_by_championship_id(@championship.id)\n @round.championship = @championship\n num_round = (@last_round4_championship == nil)? 1 : Round.maximum(:num_round) +1\n @round.num_round = num_round\n\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, :notice => 'Round was successfully created.' }\n format.json { render :json => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @round.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def start_rounds\n League.current_seasons.each(&:start_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def create\n @round = Round.new(round_params)\n @game = Game.find(@round.game_id)\n if @game.rounds.where(round_count: @round.round_count).not(player_id: current_user.id).take.exists?\n o_round = @game.rounds.where(round_count: @round.round_count).not(player_id: current_user.id).take\n @round.character = o_round.character\n else\n @round.character = CHARS[rand(26)]\n end\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:judge_id)\n end",
"def end_round_and_save\n args = request_params\n end_timing_for_round(args[:map_id], args[:round])\n save_and_remove_all(args[:map_id], args[:round])\n head :ok\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n # create matches for input\n if !params[:names].blank?\n # split input by line break\n names = params[:names].rstrip.split(/\\r?\\n/).map{|line| line.chomp}\n # insert dummy players\n if names.length % 4 == 3\n names.insert(names.length,\"★ダミーP\")\n elsif names.length % 4 == 2\n names.insert(names.length,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n elsif names.length % 4 == 1\n names.insert(names.length,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n end\n # sort if required\n if params[:sort] == \"1\"\n names = names.sort_by{rand}\n end\n courts = params[:courts].to_i\n court_select = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\"]\n # for each 4 names create match\n (names.length / 4).times do |x|\n match = Match.new\n match.round_id = @round.id\n match.court = court_select[x % courts]\n match.player1_name = names[x * 4]\n match.player2_name = names[x * 4 + 1]\n match.player3_name = names[x * 4 + 2]\n match.player4_name = names[x * 4 + 3]\n match.save\n end\n end\n \n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end",
"def save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end",
"def game_params\n params.require(:game).permit(:rounds_count)\n end",
"def round_params\n params.require(:round).permit(:character, :points, :round_count, :city, :country, :river)\n end",
"def create\n @military_battle_round = Military::BattleRound.new(params[:military_battle_round])\n\n respond_to do |format|\n if @military_battle_round.save\n format.html { redirect_to @military_battle_round, notice: 'Battle round was successfully created.' }\n format.json { render json: @military_battle_round, status: :created, location: @military_battle_round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @military_battle_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def seed_rounds(round_no, circuit_id, qly_datetime, race_datetime, qly_results_id, race_results_id)\n Round.create(round_number: round_no,\n circuit_id: circuit_id,\n qly_datetime: qly_datetime,\n race_datetime: race_datetime )\n end",
"def round_params\n params.require(:round).permit(:number, :start_time, :tournament_id,\n :notification_message)\n end",
"def create\n @round = Round.new(params[:round])\n @counter=params[:round_create_counter].to_i\n respond_to do |format|\n if @round.save\n @round.save\n format.html { redirect_to(:action => 'new', :case_study_id=>@round.case_study_id, :round_create_counter=>@counter) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def next_rounds\n League.current_seasons.each(&:next_round!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.next_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def round_params\n params.require(:round).permit(:number)\n end",
"def advance_round\n @prevrnd = Round.find(params[:id])\n \n if params[:advance_round]\n @poets = []\n @slam = @prevrnd.slam\n @newrnd = @slam.rounds.create(round_number: @prevrnd.round_number.to_i + 1)\n @newrnd.assign_poets(params[:round][:poet])\n \n @newrnd.performances.each do |p|\n @poets << p.poet\n end\n redirect_to score_path(@newrnd.id)\n elsif params[:end_slam]\n @slam = @prevrnd.slam\n @slam.update_attributes(slam_complete: true)\n redirect_to slam_final_path(@prevrnd.slam_id)\n end\n end",
"def index\n @tournament = Tournament.find(params[:tournament_id])\n @rounds = @tournament.rounds\n end",
"def create\n @player_round_loans = params[:player_round_loans].values.collect { |player_round_loan| PlayerRoundLoan.new(player_round_loan) }\n\n @player_round_loans.each do |player_round_loan|\n player_round_loan.save!\n end\n\n# @player_round_loan = PlayerRoundLoan.new(params[:player_round_loan])\n\n respond_to do |format|\n if @player_round_loans.all?(&:valid?)\n @round=Round.find(@player_round_loans[0].round_id)\n @round.played=true\n @round.save!\n # format.html { redirect_to new_player_round_investment_path(:player_id=>@player_round_loans[0].player_id, :round_id=>@player_round_loans[0].round_id, :brand_id=>@player_round_loans[0].brand_id) }\n format.html {redirect_to root_path}\n #format.html { redirect_to @player_round_loan, notice: 'Player round loan was successfully created.' }\n format.json { render json: @player_round_loan, status: :created, location: @player_round_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_round_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\r\n params.require(:round).permit(\r\n :title,\r\n :started_at,\r\n :ended_at,\r\n :plan_id,\r\n :scenario_id,\r\n :project_id,\r\n :issue_id\r\n )\r\n end",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def update\n\n atts = game_params[:rounds_attributes]\n\n temp_rounds = []\n temp_rounds_ordered = []\n\n #go through the rounds, add them to an array\n atts.each do |round|\n around = Round.new(round[1])\n temp_rounds << around\n puts around.to_s\n puts around.id.to_s\n puts round[1].class\n end\n\n #sort the new round order\n temp_rounds = temp_rounds.sort_by{|e| -e[:score]}\n place = 0\n \n\n #set the correct place in the temp array\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n temp_rounds_ordered << round\n end\n\n @game = Game.find(params[:id])\n\n @game.rounds.each do |round| \n temp_rounds_ordered.each do |tr| \n if tr.id == round.id \n round.place = tr.place\n round.player_id = tr.player_id\n round.score = tr.score\n round.asterisk = tr.asterisk\n round.correct = tr.correct\n end\n end\n end\n\n @game.description = game_params[:description]\n @game.date = game_params[:date].to_date\n\n puts @game.rounds.size\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: \"Game updated successfully!\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round_expense = RoundExpense.new(params[:round_expense])\n @round=Round.new(params[:round])\n respond_to do |format|\n if @round_expense.save\n format.html { redirect_to(@round_expense, :notice => 'Round expense was successfully created.') }\n format.xml { render :xml => @round_expense, :status => :created, :location => @round_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round_expense.errors, :status => :unprocessable_entity }\n end\n end\n @round.save\n end",
"def create\n @game_round = GameRound.new(game_round_params)\n\n respond_to do |format|\n @game_round.campaign = @campaign\n @game_round.creator = current_user\n if @game_round.save\n format.html {\n redirect_to( {action: :index}, notice: 'Game instance was successfully created.')\n }\n format.json { render :show, status: :created, location: @game_round }\n else\n format.html { render :new }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slam = Slam.new(params[:slam])\n\n respond_to do |format|\n if @slam.save\n @slam.update_attributes(master_id: current_user.id)\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n \n format.html { redirect_to edit_round_path(@round1), notice: 'Get to it!' }\n format.json { render json: @slam, status: :created, location: @slam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pmround = Pmround.new(pmround_params)\n\n respond_to do |format|\n if @pmround.save\n format.html { redirect_to @pmround, notice: 'Pmround was successfully created.' }\n format.json { render :show, status: :created, location: @pmround }\n else\n format.html { render :new }\n format.json { render json: @pmround.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end",
"def new_round \n\t\tself.remaining_players.each do |player|\n\t\t\tplayer.hands.create\n\t\tend\n\t\tself.update_attributes(:flowing_right => !self.flowing_right, :round => self.round + 1)\n\tend",
"def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end",
"def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n\n @formTemplate = FormTemplate.new(round_id: @round.id)\n @formTemplate.save\n delphiEstimation = DelphiEstimation.find_by_id(@round.delphiEstimation_id)\n project = Project.find_by_id(delphiEstimation.p_id)\n wbs = WorkBreakdownStructure.find_by p_id: project.id\n tasks = Task.where(wbs_id: wbs.id)\n tasks.each do |task|\n subtasks = Subtask.where(task_id: task.id)\n subtasks.each do |subtask|\n workpackages = Workpackage.where(subtask_id: subtask.id)\n workpackages.each do |workpackage|\n EstimationTemplate.new(form_template_id: @formTemplate.id, workpackage_id: workpackage.id, comment: '').save\n end\n end\n end\n\n format.html { redirect_to @formTemplate, notice: 'Runde wurde erfolgreich angelegt.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @round.update(round_params)\n render :show, status: :ok\n else\n render json: @round.errors, status: :unprocessable_entity\n end\n end",
"def create_rounds(game_ids)\n rounds = [[game_ids[game_ids.length - 4],\n game_ids[game_ids.length - 3],\n game_ids[game_ids.length - 2],\n game_ids[game_ids.length - 1]]]\n\n current_game_index = 0\n num_games_in_round = Bracket::NUM_TEAMS / 2\n final_game_index = current_game_index + (num_games_in_round - 1)\n while num_games_in_round >= 1\n rounds.push([])\n current_game_index.upto(final_game_index) do |game_index|\n rounds.last.push(game_ids[game_index])\n end\n num_games_in_round /= 2\n current_game_index = final_game_index + 1\n final_game_index = current_game_index + (num_games_in_round - 1)\n end\n\n rounds\n end",
"def round_params\n params.require(:round).permit(:delphiEstimation_id, :count, :closed)\n end",
"def assignment_round\n AssignmentQueue.assignment_round\n\n respond_to do |format|\n format.html do\n flash[:notice] = 'New assignment round generated'\n redirect_to action: :index\n end\n format.json { redirect_to action: :index, status: :ok }\n end\n end",
"def round_result\n @round = Round.find(params[:id])\n end",
"def game_params\n params.require(:game).permit(\n :stories,\n :draw_urls,\n :num_rounds)\n end",
"def play(rounds)\n puts \"\\nThere are #{@players.size} players and \" +\n \"#{TreasureTrove::TREASURES.size} treasures in #{@title}\"\n 1.upto(rounds) do |round|\n puts \"\\nRound #{round}\"\n @players.each do |p|\n GameTurn.take_turn(p)\n end\n end\n end",
"def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end",
"def create\n @rock = Rock.new(rock_params)\n\n if @rock.save\n render json: @rock, status: :created\n else\n render json: @rock.errors, status: :unprocessable_entity\n end\n end",
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_round\n return auth_err unless auth?\n log \"#{@color} requested a round\"\n return wait_err unless wait_round\n get_map_render\n return game_terminated_msg if game_terminated?\n return {plain: \"continue.\\n\" + @map_render} if plain?\n return {json: {message: \"It's your turn\", map: @map_render, points: @map.took_hash}}\n end",
"def pmround_params\n params.require(:pmround).permit(:round)\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: \"Round was successfully updated.\" }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:commit, :title, :number_of_questions, questions_attributes: [:id, :question, :answer])\n end",
"def create\n @winner = Winner.new(params[:winner])\n\n respond_to do |format|\n if @winner.save\n format.html { redirect_to @winner, notice: 'Winner was successfully created.' }\n format.json { render json: @winner, status: :created, location: @winner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_first_round\n for i in 1..4\t\n Round.create(:slam_id => self.id, :roundNumber => i)\n end\n end",
"def index\n @aggregation_rounds = AggregationRound.all\n end",
"def complete_lap\n if user_signed_in?\n current_user.completed_repetition_rounds.create!(\n repetition_round_params.merge(repetition_level_id: @level.id)\n )\n end\n render json: {}\n end",
"def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end",
"def start_next_round\n strong_params = params.permit(:id)\n game = Game.find(strong_params[:id])\n StartNextRound.new(game).call\n\n redirect_to game\n end",
"def create\n @shooting_round = ShootingRound.new(params[:shooting_round])\n @shooting_round.s_session = @shooting_session\n\n respond_to do |format|\n if @shooting_round.save\n format.html { redirect_to(shooting_back() , :notice => 'Shooting round was successfully created.') }\n format.xml { render :xml => @shooting_round, :status => :created, :location => @shooting_round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shooting_round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @league = League.new(league_params)\n\n respond_to do |format|\n if @league.save\n\n (0..(@league.size-1)).each_with_index do |i|\n fantasy_team = @league.fantasy_teams.create(owner: \"Team #{i+1}\", pick_number: i+1)\n picks = []\n\n ([email protected]_size).each do |round|\n offset = round % 2 == 1 ? i + 1: @league.size - i\n pick = (round-1)*@league.size + offset\n @league.draft_picks.create(number: pick, fantasy_team: fantasy_team)\n end\n\n puts \"Team #{i} gets picks #{fantasy_team.draft_picks.map(&:number)}\\n\"\n end\n\n format.html { redirect_to @league, notice: 'League was successfully created.' }\n format.json { render :show, status: :created, location: @league }\n else\n format.html { render :new }\n format.json { render json: @league.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params) && @round.debate.rounds.count >= 3\n format.html { redirect_to @round.debate, notice: 'Your debate is now over. Share with friends and check back later for results.' }\n format.json { render :show, status: :ok, location: @round }\n elsif @round.update(round_params) && @round.debate.rounds.count < 3\n format.html { redirect_to @round.debate, notice: 'The previous round is now complete.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { redirect_to @round.debate, notice: @round.errors.full_messages.first[7..100]}\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:players_num, :rounds_num, :currently_scored, :joined_players, :creator_id, :round_number)\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end"
] | [
"0.7104489",
"0.7104489",
"0.70039594",
"0.6991256",
"0.6908583",
"0.6889093",
"0.68323505",
"0.6823776",
"0.68040234",
"0.6674662",
"0.66656566",
"0.65715724",
"0.6561143",
"0.65382886",
"0.64882076",
"0.6380548",
"0.63772136",
"0.63772136",
"0.63759726",
"0.6367244",
"0.6356194",
"0.63559806",
"0.6336218",
"0.6292752",
"0.62434053",
"0.6225809",
"0.6191883",
"0.6179848",
"0.61756253",
"0.61515844",
"0.6141703",
"0.6112448",
"0.60982",
"0.60879934",
"0.60048217",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.59764457",
"0.59636265",
"0.5874804",
"0.5861651",
"0.5856571",
"0.58480513",
"0.58462894",
"0.5845883",
"0.58174515",
"0.5813511",
"0.57975465",
"0.5758682",
"0.57563895",
"0.5727398",
"0.5683696",
"0.5682579",
"0.5665613",
"0.5661273",
"0.565852",
"0.5648734",
"0.56421065",
"0.5625231",
"0.5614057",
"0.55815285",
"0.55747545",
"0.5561388",
"0.5554313",
"0.554952",
"0.55021006",
"0.5497865",
"0.54623365",
"0.54488623",
"0.5439508",
"0.5438504",
"0.54351336",
"0.54341793",
"0.54146004",
"0.54122525",
"0.54052985",
"0.536652",
"0.53569883",
"0.53546196",
"0.53511786",
"0.53398573",
"0.5337838",
"0.5334656",
"0.5325103",
"0.5324663",
"0.53226995",
"0.5317065",
"0.53163755",
"0.53114617",
"0.5297571",
"0.5269979",
"0.5266715",
"0.5266003",
"0.5266003",
"0.5266003"
] | 0.6803231 | 9 |
PATCH/PUT /rounds/1 PATCH/PUT /rounds/1.json | def update
respond_to do |format|
if @round.update(round_params)
format.html { redirect_to :root }
format.json { render :show, status: :ok, location: @round }
else
format.html { render :edit }
format.json { render json: @round.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update_from_json(round_params['round'])\n update_parents(@round)\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to :back, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: \"Round was successfully updated.\" }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to(@round, :notice => 'Round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to(@round, :notice => 'Round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to(@round, :notice => 'Round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round = @season.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n flash[:notice] = 'Round was successfully updated.'\n format.html { redirect_to season_round_path(@round.season, @round) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html do redirect_to @round, notice: 'Round was successfully updated.' end\n format.json { render :show, status: :ok, location: @round }\n else\n @form_for = @round\n format.html do render :edit end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grant_round = GrantRound.find(params[:id])\n\n if @grant_round.update(grant_round_params (params[:grant_round]))\n head :no_content\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @round.update(round_params)\n render :show, status: :ok\n else\n render json: @round.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @game_round.update(game_round_params)\n format.html { redirect_to case_game_rounds_path , notice: 'Game instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_round }\n else\n format.html { render :edit }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shooting_round = ShootingRound.find(params[:id])\n\n respond_to do |format|\n if @shooting_round.update_attributes(params[:shooting_round])\n format.html { redirect_to(shooting_back() , :notice => 'Shooting round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shooting_round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game_round.update(game_round_params)\n\n if @game_round.started? && @game_round.previous_changes.key?( 'custom_highlow')\n RedisService.custom_game_ground_winlose @game_round\n end\n\n format.html { redirect_to action: :index, notice: 'Game round was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_round }\n else\n format.html { render :edit }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n if @military_battle_round.update_attributes(params[:military_battle_round])\n format.html { redirect_to @military_battle_round, notice: 'Battle round was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @military_battle_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n @fight = Fight.find(@round.fight_id)\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @fight, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @round.update(round_params)\r\n set_rounds_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.updated', model: Round.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :edit }\r\n format.js { render :edit }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @round.update(round_params) && @round.debate.rounds.count >= 3\n format.html { redirect_to @round.debate, notice: 'Your debate is now over. Share with friends and check back later for results.' }\n format.json { render :show, status: :ok, location: @round }\n elsif @round.update(round_params) && @round.debate.rounds.count < 3\n format.html { redirect_to @round.debate, notice: 'The previous round is now complete.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { redirect_to @round.debate, notice: @round.errors.full_messages.first[7..100]}\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boxscore = @game.boxscores.find(params[:id])\n \n\n respond_to do |format|\n if @boxscore.update_attributes(params[:boxscore])\n format.html { redirect_to game_boxscores_url(@game), notice: 'Boxscore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boxscore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n params[:round][:start_date] = Date.strptime(params[:round][:start_date], '%d/%m/%Y').strftime.to_s\n params[:round][:end_date] = Date.strptime(params[:round][:end_date], '%d/%m/%Y').strftime.to_s\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, :notice => 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update\n @replay = Replay.find(params[:id])\n @replay.level_id = params[:replay][:level_id]\n @replay.score = params[:replay][:score]\n @replay.player = params[:replay][:player]\n @replay.data = params[:replay][:data].read\n\n respond_to do |format|\n\n format.html { redirect_to replays_path, :notice => 'Replay was successfully updated.' }\n format.json { head :no_content }\n\n end\n end",
"def update\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @box_score = BoxScore.find(params[:id])\n\n respond_to do |format|\n if @box_score.update_attributes(params[:box_score])\n format.html { redirect_to @box_score, notice: 'Box score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rock = Rock.find(params[:id])\n\n respond_to do |format|\n if @rock.update_attributes(params[:rock])\n format.html { redirect_to @rock, notice: 'Rock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n atts = game_params[:rounds_attributes]\n\n temp_rounds = []\n temp_rounds_ordered = []\n\n #go through the rounds, add them to an array\n atts.each do |round|\n around = Round.new(round[1])\n temp_rounds << around\n puts around.to_s\n puts around.id.to_s\n puts round[1].class\n end\n\n #sort the new round order\n temp_rounds = temp_rounds.sort_by{|e| -e[:score]}\n place = 0\n \n\n #set the correct place in the temp array\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n temp_rounds_ordered << round\n end\n\n @game = Game.find(params[:id])\n\n @game.rounds.each do |round| \n temp_rounds_ordered.each do |tr| \n if tr.id == round.id \n round.place = tr.place\n round.player_id = tr.player_id\n round.score = tr.score\n round.asterisk = tr.asterisk\n round.correct = tr.correct\n end\n end\n end\n\n @game.description = game_params[:description]\n @game.date = game_params[:date].to_date\n\n puts @game.rounds.size\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: \"Game updated successfully!\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @player_box_score = PlayerBoxScore.find(params[:id])\n\n respond_to do |format|\n if @player_box_score.update_attributes(params[:player_box_score])\n format.html { redirect_to @player_box_score, notice: 'Player box score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_box_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aggregation_round.update(aggregation_round_params)\n format.html { redirect_to @aggregation_round, notice: 'Aggregation round was successfully updated.' }\n format.json { render :show, status: :ok, location: @aggregation_round }\n else\n format.html { render :edit }\n format.json { render json: @aggregation_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n if @playground.update_attributes(params[:playground])\n format.html { redirect_to @playground, :notice => 'Playground was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @playground.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round.update!(round_params)\n notify_clients\n redirect_to game_path(@round.game) # with turbolinks\n rescue\n render layout: false, status: :bad_request\n end",
"def update\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n if @rum.update_attributes(params[:rum])\n format.html { redirect_to @rum, notice: 'Rum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n if @playground.update_attributes(params[:playground])\n format.html { redirect_to @playground, notice: 'Playground was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @playground.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @livestock = Livestock.find(params[:id])\n\n respond_to do |format|\n if @livestock.update_attributes(params[:livestock])\n format.html { redirect_to @livestock, notice: 'Livestock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @livestock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @swap.update(swap_params)\n format.html { redirect_to round_swaps_path(@round), notice: 'Swap was successfully updated.' }\n format.json { render :show, status: :ok, location: @swap }\n else\n format.html { render :edit }\n format.json { render json: @swap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @game.turn = params[:game][:turn]\n @game.finished = params[:game][:finished]\n @game.winner = params[:game][:winner]\n @game.overall_score = ActiveSupport::JSON.decode(params[:game][:overall_score])\n @game.game_state = ActiveSupport::JSON.decode(params[:game][:game_state])\n\n respond_to do |format|\n if @game.save\n format.json { head :no_content }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n format.html { redirect_to @box, notice: 'Box was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n\n respond_to do |format|\n if @player_round_loan.update_attributes(params[:player_round_loan])\n format.html { redirect_to @player_round_loan, notice: 'Player round loan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_round_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @box_score_entry = BoxScoreEntry.find(params[:id])\n\n respond_to do |format|\n if @box_score_entry.update_attributes(params[:box_score_entry])\n format.html { redirect_to @box_score_entry, :notice => 'Box score entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @box_score_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @box_score_entry.update(box_score_entry_params)\n format.html { redirect_to @box_score_entry, notice: 'Box score entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @box_score_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end",
"def update\n respond_to do |format|\n if @round.make_guess(params[\"round\"][\"guessed_letter\"])\n update_current_player\n format.html { redirect_to game_round_path(@game, @round) }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { redirect_to game_round_path(@game, @round), notice: 'Invalid guess' }\n format.json { render :show, status: :created, location: @round }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n update_standings\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shuttle_run.update(shuttle_run_params)\n format.html { redirect_to @shuttle_run, notice: 'Shuttle run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shuttle_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @run = Run.find(params[:id])\n\n respond_to do |format|\n if @run.update_attributes(params[:run])\n format.html { redirect_to @run, :notice => 'Run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @run.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @winner = Winner.find(params[:id])\n\n respond_to do |format|\n if @winner.update_attributes(params[:winner])\n format.html { redirect_to @winner, notice: 'Winner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bracketcontest.update(bracketcontest_params)\n\tsave_contestants()\n\tflash[:notice] = 'Bracketcontest was successfully updated.' \n format.html { redirect_to [@bracketgrouping, @bracketcontest]}\n format.json { render :show, status: :ok, location: @bracketcontest }\n else\n format.html { render :edit }\n format.json { render json: @bracketcontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n\n respond_to do |format|\n if @round_robin_promo.update_attributes(params[:round_robin_promo])\n format.html { redirect_to @round_robin_promo, notice: 'Round robin promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round_robin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @run = Run.find(params[:id])\n\n respond_to do |format|\n if @run.update_attributes(params[:run])\n format.html { redirect_to @run, notice: 'Run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pmround.update(pmround_params)\n format.html { redirect_to @pmround, notice: 'Pmround was successfully updated.' }\n format.json { render :show, status: :ok, location: @pmround }\n else\n format.html { render :edit }\n format.json { render json: @pmround.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_outcome.update(api_v1_outcome_params)\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_outcome }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stuck.update(stuck_params)\n format.html { redirect_to @stuck, notice: 'Stuck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stuck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @runner = Runner.find(params[:id])\n\n respond_to do |format|\n if @runner.update_attributes(params[:runner])\n format.html { redirect_to @runner, notice: 'Runner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @runner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:team_id])\n @sprint = @team.sprints.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [@sprint.team, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @round_expense = RoundExpense.find(params[:id])\n\n respond_to do |format|\n if @round_expense.update_attributes(params[:round_expense])\n format.html { redirect_to(@round_expense, :notice => 'Round expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_run.update(test_run_params)\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_run }\n else\n format.html { render :edit }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end",
"def update\n \n @fixture = Fixture.find(params[:id])\n\n\[email protected] = @fixture.winningteam.points + 3\n\[email protected]\n respond_to do |format|\n if @fixture.update_attributes(params[:fixture])\n format.html { redirect_to @fixture, notice: 'Fixture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint = Sprint.find(params[:id])\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to @sprint, notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_livestock = UserLivestock.find(params[:id])\n\n respond_to do |format|\n if @user_livestock.update_attributes(params[:user_livestock])\n format.html { redirect_to @user_livestock, notice: 'User livestock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_livestock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n if @game.final? then\n recalculate_points\n end\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chicken_run.update(chicken_run_params)\n format.html { redirect_to @chicken_run, notice: 'Chicken run was successfully updated.' }\n format.json { render :show, status: :ok, location: @chicken_run }\n else\n format.html { render :edit }\n format.json { render json: @chicken_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @bench.update(bench_params)\n format.html { redirect_to @bench, notice: 'Bench was successfully updated.' }\n format.json { render :show, status: :ok, location: @bench }\n else\n format.html { render :edit }\n format.json { render json: @bench.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:judge_id, :status)\n end",
"def update\n respond_to do |format|\n if @turn.update(turn_params)\n format.html { redirect_to @turn, notice: 'Turn was successfully updated.' }\n format.json { render :show, status: :ok, location: @turn }\n else\n format.html { render :edit }\n format.json { render json: @turn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n (kick and return) if not is_god?\n if (params[:team].has_key? :pass_hash) and (params.has_key? :do_hash)\n clear_pass = params[:team][:pass_hash]\n hash = Digest::SHA1.base64digest clear_pass\n params[:team][:pass_hash] = hash\n end\n @team = Team.find(params[:id])\n points_adjust = params[:points_adjust].to_i\n @team.points = @team.points + points_adjust\n\n pref = 'has_solved_'\n puzzles_to_set_solved = params.keys.select do |k| \n k.start_with? pref\n end.map do |k|\n k.sub(pref, '').to_i\n end\n actual_solved_ids = @team.puzzles.map{|p| p.id}\n # puts actual_solved_ids.inspect\n # puts puzzles_to_set_solved.inspect\n\n puzzles_to_set_solved.each do |pid|\n if not actual_solved_ids.include? pid\n s = Solve.new(:puzzle_id => pid, :team_id => @team.id, :time_solved => Time.now)\n s.save\n end\n end\n actual_solved_ids.each do |pid|\n if not puzzles_to_set_solved.include? pid\n Solve.where(:puzzle_id => pid, :team_id => @team.id).destroy_all\n Callin.where(:puzzle_id => pid, :team_id => @team.id).destroy_all\n end\n end\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: update_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tp = test_params.merge!(plate_id: params[:plate_id])\n respond_to do |format|\n if @test.update(tp)\n format.html { redirect_to [@plate, @test], notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playground.update(playground_params)\n format.html { redirect_to @playground, notice: 'Playground was successfully updated.' }\n format.json { render :show, status: :ok, location: @playground }\n else\n format.html { render :edit }\n format.json { render json: @playground.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @box.update(box_params)\n format.html { redirect_to @box, notice: 'Box was successfully updated.' }\n format.json { render :show, status: :ok, location: @box }\n else\n format.html { render :edit }\n format.json { render json: @box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [:admin, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operations_check = OperationsCheck.find(params[:id])\n\n respond_to do |format|\n if @operations_check.update_attributes(operations_check_params)\n format.html { redirect_to @operations_check, \n notice: 'Operations check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operations_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to runner_shoes_path, notice: 'Zapatilla actualizada satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rice3.update(rice3_params)\n format.html { redirect_to @rice3, notice: 'Rice3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @rice3 }\n else\n format.html { render :edit }\n format.json { render json: @rice3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n params[:game][:points].each do |k, v|\n score = Score.find_by_id(k)\n score.update_attributes(points: v)\n d = params[:direction][k]\n #direc = Score::DIRECTIONS.invert\n score.update_attributes(direction: d) # direc[d])\n end\n\n respond_to do |format|\n if @game.update_attributes(table: params[:game][:table],\n number: params[:game][:number],\n status: params[:game][:status])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n block_non_user\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @round = Round.find(params[:id])\n @poets = Poet.all\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n if @trainer.update(trainer_params)\n head :no_content\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @runtest.update(runtest_params)\n format.html { redirect_to @runtest, notice: 'Runtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @runtest }\n else\n format.html { render :edit }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7072058",
"0.703137",
"0.68880683",
"0.68509346",
"0.6767903",
"0.6767903",
"0.6712788",
"0.66683185",
"0.6655102",
"0.6655102",
"0.6627183",
"0.66132647",
"0.65992844",
"0.6535786",
"0.63719124",
"0.6328629",
"0.6312666",
"0.61335635",
"0.61317116",
"0.61029226",
"0.6057517",
"0.605726",
"0.60566247",
"0.59122527",
"0.5910795",
"0.584069",
"0.5837628",
"0.5830443",
"0.58285785",
"0.5826549",
"0.57993215",
"0.57972467",
"0.57851875",
"0.5781376",
"0.57764035",
"0.57761115",
"0.57749075",
"0.5754879",
"0.57482487",
"0.57326305",
"0.57277447",
"0.5722225",
"0.5719372",
"0.5714272",
"0.57109445",
"0.5706843",
"0.5705736",
"0.5700458",
"0.56939304",
"0.5690985",
"0.5687194",
"0.5686431",
"0.5686009",
"0.5673438",
"0.5669226",
"0.56654596",
"0.56621057",
"0.56509644",
"0.56497175",
"0.5649105",
"0.5641143",
"0.5638315",
"0.56377363",
"0.5637165",
"0.56335",
"0.5633445",
"0.5625835",
"0.56123656",
"0.56121045",
"0.56086606",
"0.5607232",
"0.5604784",
"0.56014884",
"0.5601232",
"0.55915505",
"0.5591242",
"0.5588591",
"0.5582892",
"0.55788285",
"0.55772763",
"0.5576719",
"0.55749",
"0.55714035",
"0.55714035",
"0.5562248",
"0.55573046",
"0.5555273",
"0.55506593",
"0.554947",
"0.55463284",
"0.55445",
"0.5543411",
"0.5542969",
"0.55384463",
"0.5537617",
"0.5536367",
"0.5532928",
"0.55292976",
"0.5523394",
"0.5510267"
] | 0.6678458 | 7 |
DELETE /rounds/1 DELETE /rounds/1.json | def destroy
@round.destroy
respond_to do |format|
format.html { redirect_to root_url, notice: 'Round was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to game_rounds_url(@game), notice: 'Round was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: \"Round was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shooting_round = ShootingRound.find(params[:id])\n @shooting_round.destroy\n\n respond_to do |format|\n format.html { redirect_to(shooting_back() ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @game.rounds.destroy_all\n # raise @game.inspect\n @game.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n tournament = @round.tournament\n @round.destroy\n respond_to do |format|\n format.html do\n redirect_to tournament_path(tournament), notice: 'Round was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @military_battle_round = Military::BattleRound.find(params[:id])\n @military_battle_round.destroy\n\n respond_to do |format|\n format.html { redirect_to military_battle_rounds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @grant_round = GrantRound.find(params[:id])\n @grant_round.destroy\n\n head :no_content\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to DelphiEstimation.find_by_id(@round.delphiEstimation_id), notice: 'Round wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_round.destroy\n respond_to do |format|\n format.html { redirect_to game_rounds_url, notice: 'Game round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @aggregation_round.destroy\n respond_to do |format|\n format.html { redirect_to aggregation_rounds_url, notice: 'Aggregation round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n game = @round.game\n @round.destroy\n redirect_to edit_game_path(game), notice: 'Round was successfully destroyed.'\n end",
"def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shuttle_run.destroy\n respond_to do |format|\n format.html { redirect_to shuttle_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to replays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rum = Rum.find(params[:id])\n @rum.destroy\n\n respond_to do |format|\n format.html { redirect_to rums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @boxscore = @game.boxscores.find(params[:id])\n @boxscore.destroy\n\n respond_to do |format|\n format.html { redirect_to @game }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round_expense = RoundExpense.find(params[:id])\n @round_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(round_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @livestock = Livestock.find(params[:id])\n @livestock.destroy\n\n respond_to do |format|\n format.html { redirect_to livestocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test10 = Test10.find(params[:id])\n @test10.destroy\n\n respond_to do |format|\n format.html { redirect_to test10s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pmround.destroy\n respond_to do |format|\n format.html { redirect_to pmrounds_url, notice: 'Pmround was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock = Rock.find(params[:id])\n @rock.destroy\n\n respond_to do |format|\n format.html { redirect_to rocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shoot = Shoot.find(params[:id])\n @shoot.destroy\n\n respond_to do |format|\n format.html { redirect_to shoots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n @player_round_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to player_round_loans_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @turn.destroy\n respond_to do |format|\n format.html { redirect_to turns_url, notice: 'Turn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rockhound.destroy\n respond_to do |format|\n format.html { redirect_to rockhounds_url, notice: 'Rockhound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reloud_check = ReloudCheck.find(params[:id])\n @reloud_check.destroy\n\n respond_to do |format|\n format.html { redirect_to reloud_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @take = Take.find(params[:id])\n @take.destroy\n\n respond_to do |format|\n format.html { redirect_to takes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @round.destroy\r\n\r\n respond_to do |format|\r\n set_rounds_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.destroyed', model: Round.model_name.human) }\r\n format.js\r\n end\r\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @turno = Turno.find(params[:id])\n @turno.destroy\n\n respond_to do |format|\n format.html { redirect_to turno_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_stat = GameStat.find(params[:id])\n @game_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n @box_score_entry.destroy\n respond_to do |format|\n format.html { redirect_to box_score_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @turnover = Turnover.find(params[:id])\n @turnover.destroy\n\n respond_to do |format|\n format.html { redirect_to turnovers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @mosttinytrial = Mosttinytrial.find(params[:id])\n @mosttinytrial.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinytrials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @open_shoot = OpenShoot.find(params[:id])\n @open_shoot.destroy\n\n respond_to do |format|\n format.html { redirect_to open_shoots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystock.destroy\n respond_to do |format|\n format.html { redirect_to mystocks_path, notice: 'mystock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holdgame = Holdgame.find(params[:id])\n @holdgame.destroy\n\n respond_to do |format|\n format.html { redirect_to gamesmaps_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holdgame = Holdgame.find(params[:id])\n @holdgame.destroy\n\n respond_to do |format|\n format.html { redirect_to gamesmaps_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @box_score = BoxScore.find(params[:id])\n @box_score.destroy\n\n respond_to do |format|\n format.html { redirect_to box_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @runtest.destroy\n respond_to do |format|\n format.html { redirect_to runtests_url, notice: 'Runtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @winner = Winner.find(params[:id])\n @winner.destroy\n\n respond_to do |format|\n format.html { redirect_to winners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def delete_retry_test id\n uri = URI(HOST + \"/retry_test/#{id}\")\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Delete.new(uri.path)\n http.request(req)\n end",
"def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub = Nightclub.find(params[:id])\n @nightclub.destroy\n\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repeating_transfer.destroy\n respond_to do |format|\n format.html { redirect_to repeating_transfers_url, notice: 'Repeating transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @chicken_run.destroy\n respond_to do |format|\n format.html { redirect_to chicken_runs_url, notice: 'Chicken run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end"
] | [
"0.76205236",
"0.76205236",
"0.76205236",
"0.7431568",
"0.7431568",
"0.7430822",
"0.7422256",
"0.72982204",
"0.72982204",
"0.72982204",
"0.72982204",
"0.7291912",
"0.72501194",
"0.7098678",
"0.69999164",
"0.6967715",
"0.6926577",
"0.69074655",
"0.68914616",
"0.68591595",
"0.68037254",
"0.66976833",
"0.6649538",
"0.66202444",
"0.6617758",
"0.6575273",
"0.65558344",
"0.65235394",
"0.6500196",
"0.646447",
"0.6453011",
"0.64219296",
"0.6400944",
"0.6379957",
"0.6370882",
"0.6366649",
"0.6366191",
"0.63649166",
"0.63628465",
"0.6361509",
"0.6354436",
"0.6349867",
"0.633197",
"0.632582",
"0.6325337",
"0.63251644",
"0.6324765",
"0.6314804",
"0.63141435",
"0.63062835",
"0.63031584",
"0.6299514",
"0.62986565",
"0.62970036",
"0.62961084",
"0.6294331",
"0.6294331",
"0.62925714",
"0.62908775",
"0.6290618",
"0.6289011",
"0.6289011",
"0.6289011",
"0.6289011",
"0.6287082",
"0.6285907",
"0.628314",
"0.6282379",
"0.62819207",
"0.6281098",
"0.6280628",
"0.6268911",
"0.62675995",
"0.6266904",
"0.6261091",
"0.6261091",
"0.62563384",
"0.62492377",
"0.6248947",
"0.62472695",
"0.62472695",
"0.62472695",
"0.62472695",
"0.62440145",
"0.6242373",
"0.62411714",
"0.62351745",
"0.6234144",
"0.6233593",
"0.62334174",
"0.62319213",
"0.6228615",
"0.62280166",
"0.6223242",
"0.6219196",
"0.62189275",
"0.62185526",
"0.62179315",
"0.6215333",
"0.62135196"
] | 0.72139317 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_round
if params[:id]
@round = Round.find(params[:id])
else
current_round_finished = false
finds = []
upcoming_round = Round.where(month: (Time.zone.now.beginning_of_month + 1.month)).first
current_round = Round.where(month: Time.zone.now.beginning_of_month).first
if current_round != nil
current_round.albums.each do |album|
if album.find != nil
finds << album
end
end
end
if finds.count == 3
current_round_finished = true
end
if upcoming_round != nil && current_round_finished == false
@round = upcoming_round
@current_round = false
else
@round = current_round
@current_round = true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def _handle_action_missing(*args); end"
] | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865",
"0.53135896",
"0.52999926",
"0.5297309",
"0.5296569",
"0.5261449",
"0.5247048",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52323204",
"0.52310973",
"0.523081",
"0.5225785",
"0.5219039",
"0.52136266",
"0.5208033",
"0.520763",
"0.5177365",
"0.5175224",
"0.5173357",
"0.5166104",
"0.5162502",
"0.51573396",
"0.5154547",
"0.5153531",
"0.51502854",
"0.51436496",
"0.5142863",
"0.51330835",
"0.5115634",
"0.5115634",
"0.511527",
"0.5109693",
"0.51076853",
"0.5093146",
"0.5090683",
"0.50829846",
"0.50819314",
"0.50670373",
"0.5055505",
"0.5053398",
"0.50504035",
"0.50504035",
"0.5037765",
"0.5027292",
"0.5024484",
"0.50150335",
"0.5014069",
"0.50022113",
"0.5001542",
"0.49981874",
"0.49915564",
"0.49915564",
"0.49880967",
"0.4982312",
"0.49787375",
"0.49786067",
"0.49687737",
"0.49676532",
"0.49602765",
"0.49565676",
"0.49550772",
"0.495342",
"0.49522525",
"0.49463704",
"0.49447197",
"0.49362713",
"0.49328062",
"0.49280638",
"0.49272856",
"0.4927058",
"0.49221697",
"0.4919526",
"0.49185994",
"0.49184805",
"0.49170163",
"0.49168405",
"0.49167764"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def round_params
params.require(:round).permit(:month,
albums_attributes: [:id, :title, :band, :cover, :rdio_link, :found, :link, :link_text, :round_id, :review, :finder, :finder_photo,
places_attributes: [:id, :teaser, :name, :link, :address, :city, :state, :description, :link_text, :album_id],
hints_attributes: [:id, :name, :description, :photo, :thumbnail, :album_id],
find_attributes: [:id, :user_id, :album_id, :photo]
])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def url_whitelist; end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894",
"0.6289475",
"0.62831545",
"0.6242381",
"0.6240358",
"0.6217451",
"0.6214354",
"0.62098235",
"0.61918235",
"0.6177287",
"0.61755854",
"0.61712915",
"0.61620486",
"0.6151379",
"0.61510575",
"0.6145169",
"0.61207956",
"0.6115647",
"0.6107701",
"0.61030304",
"0.60909295",
"0.60797",
"0.60701567",
"0.6062068",
"0.60203075",
"0.60167485",
"0.60125494",
"0.6009718",
"0.6007027",
"0.6007027",
"0.6000283",
"0.59990394",
"0.5996995",
"0.59915864",
"0.59914654",
"0.59912056",
"0.5979621",
"0.596686",
"0.5959418",
"0.59585625",
"0.59583765",
"0.5958032",
"0.5952298",
"0.5951678",
"0.5941885",
"0.59378815",
"0.59376645",
"0.59376645",
"0.5933908",
"0.59302104",
"0.5924862",
"0.5923981",
"0.59165645",
"0.5909916",
"0.590986",
"0.5908378",
"0.5904956",
"0.5897421",
"0.58970135",
"0.5894611",
"0.5893914",
"0.58927566",
"0.5891277",
"0.5885355",
"0.58825094",
"0.58783555",
"0.58728755",
"0.58686864",
"0.5867015",
"0.58660764",
"0.58659357",
"0.5864526",
"0.58634263",
"0.5861585",
"0.5861255",
"0.5858771",
"0.58579147",
"0.5854071",
"0.5853147",
"0.58498794",
"0.58492327"
] | 0.0 | -1 |
returns the word of the sentence that contains the most vowels. | def most_vowels(sentence)
vowels = "aeiou"
vowelCount = Hash.new(0);
sentence.split(" ").each do |word|
word.each_char do |char|
if vowels.include?(char)
vowelCount[word] += 1
end
end
end
sortedArr = vowelCount.sort_by { |k, v| v}
return sortedArr[-1][0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_vowels(sentence)\n \tcountMost = 0\n \tmostVowelWord = \"\"\n \tsentence.split.each do |word|\n \tcurrent = countVowels(word)\n \tif current > countMost\n countMost = current\n mostVowelWord = word\n end\n end\n \treturn mostVowelWord\nend",
"def most_vowels(sentence)\n words = sentence.split(' ')\n vowels = 'aeiou'\n words_hash = {}\n\n words.each do |word|\n char_count = 0\n word.each_char do |char|\n if vowels.include?(char)\n char_count += 1\n end\n end\n words_hash[word] = char_count\n end\n\n sorted_hash = words_hash.sort_by { |k, v| v }\n return sorted_hash[sorted_hash.length - 1][0]\nend",
"def most_vowels(sentence)\n parts = sentence.split\n hash = {}\n parts.each { |word| hash[word] = count_vowels(word)}\n hash.sort_by { |k, v| v }[-1][0]\nend",
"def most_vowels(sentence)\n counts = {}\n \n sentence.split.each do |word|\n counts[word] = vowel_count(word)\n end\n \n sorted = counts.sort_by { |k,v| v}\n return sorted[-1][0]\n end",
"def most_vowels(sentence)\n\tvowels = \"aeiou\"\n \tresult = Hash.new(0)\n \twords = sentence.split(\" \")\n\n \twords.each do |word|\n word.each_char do |c|\n if vowels.include?(c)\n result[word] += 1\n end\n end\n end\n\n \tlargest = 0\n \tthe_word = \"\"\n \tresult.each do |k, v|\n if v > largest\n largest = v\n the_word = k\n end\n end\n \treturn the_word\n\nend",
"def most_vowels(sentence)\r\n mostVowels = {\"word\" => '', \"count\" => 0}\r\n sentence.split(\" \").each do |word|\r\n \tcount = 0\r\n word.each_char do |char|\r\n if 'aeiou'.include?(char)\r\n count += 1\r\n end\r\n end\r\n if count > mostVowels[\"count\"]\r\n mostVowels[\"word\"] = word\r\n mostVowels[\"count\"] = count\r\n end\r\n end\r\n return mostVowels[\"word\"]\r\nend",
"def most_vowels(str)\n words = str.split(\" \")\n hash = Hash.new(0)\n words.each do |word|\n hash[word] = vowel_count(word)\n end\n sorted_hash = hash.sort_by { |key, val| val} # [[\"a\", 1], [\"what\", 1], [\"life\", 2], [\"wonderful\", 3]]\n return sorted_hash[-1][0]\nend",
"def most_common_vowel(string)\nend",
"def most_common_vowel(string)\n vowels = string.downcase.split(\"\").select {|char| char =~ /[aeiou]/}.sort\n vowel_frequency = {}\n vowels.each do |vowel|\n if vowel_frequency.has_key?(vowel)\n vowel_frequency[vowel] += 1\n else\n vowel_frequency[vowel] = 1\n end\n end\n max_frequency = vowel_frequency.values.max\n vowel_frequency.each do |k, v|\n return k if v === max_frequency\n end\nend",
"def most_common_vowel(string)\n\t\n\tvowels = Hash.new 0\n\tsplitted_string = string.split(\"\")\n\tvowels_hash = Hash.new\n\tsplitted_string.each do |letter|\n\t\tvowels[letter] += 1\n\tend\n\t\t\n\tvowels.each do |key,value| \n\t\t\n\t\tif key == \"a\" \n\t\t\tvowels_hash[key] = value\n\t\telsif key == \"e\" \n\t\t vowels_hash[key] = value\n\t\telsif key == \"i\" \n\t\t vowels_hash[key] = value\n\t\telsif key == \"o\" \n\t\t vowels_hash[key] = value\n\t\telsif key == \"u\" \n\t\t vowels_hash[key] = value\n\t\telsif key == \"y\"\n\t\t\tvowels_hash[key] = value\n\t\tend\n\t\t\n\t\t\n\tend\n\t top_letter = \"\"\n\t\tmax_letter = vowels_hash.max_by { |k, v| v}\n\t\tmax_letter.first\nend",
"def most_common_vowel(string)\n alpha = %w[a e i o u]\n letters = string.split(\" \").join(\" \").chars\n our = letters.select {|x| alpha.include?(x) }\n count = Hash.new(0)\n our.each do |x|\n count[x] += 1\n end\ncount.sort_by {|k, v| v}.last.first\nend",
"def most_common_vowel(string)\n vowels_hash = {\"a\" => 0 ,\"e\" => 0,\"i\" => 0,\"o\" => 0,\"u\" => 0}\n chars = string.split(\"\")\n chars.each do |char|\n if vowels_hash[char] != nil\n vowels_hash[char] += 1\n end\n end\n sorted = vowels_hash.sort_by {|k,v| v}.last.first\nend",
"def most_vowels(sentence)\n\n arr = sentence.split(\" \")\n fullArr = []\n counter = 0\n vowels = \"aeiou\"\n rtrArr = []\n \n arr.each_with_index do |ele, idx|\n setupArr = []\n locCount = 0\n\n ele.each_char do |let|\n if vowels.include?(let)\n locCount += 1\n else\n next\n end\n end\n\n fullArr << setupArr.push(locCount, idx)\n end\n\n fullArr.each do |ele2|\n if ele2[0] > counter\n rtrArr[0] = arr[ele2[1]]\n counter = ele2[0]\n else\n next\n end\n end\n return rtrArr.join(\"\")\nend",
"def most_common_vowel(string)\n count = Hash.new(0)\n vowels = %w(a e i o u)\n string.each_char do |letter|\n count[letter] += 1 if vowels.include?(letter)\n end \n\n count.sort_by { |k, v| v }.last.first\nend",
"def most_common_vowel(string)\n hash = Hash.new(0)\n vowels = 'aeiou'\n string.each_char do |char|\n hash[char] += 1 if vowels.include?(char)\n end\n hash.keys.sort.each do |k|\n return k if hash[k] == hash.values.max\n end\nend",
"def most_common_vowel(string)\n vowels = %w(a e i o u)\n most_common = ['a', 0]\n string.each_char.reduce(Hash.new(0)) do |acc, ch|\n acc[ch] += 1 if vowels.include?(ch)\n if acc[ch] > most_common.last\n most_common = [ch, acc[ch]]\n elsif acc[ch] == most_common.last && ch < most_common.first\n most_common = [ch, acc[ch]]\n end\n acc\n end\n most_common.first\nend",
"def most_common_vowel(string)\n hsh = {a:0,e:0,i:0,o:0,u:0}\n string.each_char do |c|\n hsh.each do |k, v|\n if k.to_s == c\n hsh[k] += 1\n end\n end\n end\n hsh.keys_for_value(hsh.values.max).sort.first.to_s\nend",
"def most_common_vowel(string)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n hash = Hash.new(0)\n string.each_char {|char| hash[char] += 1}\n hash.sort_by {|k, v| v}.last.first\nend",
"def most_common_vowel(string)\n hash = Hash.new(0)\n vowels = \"aeiou\".chars\n string.chars do |letter|\n if vowels.include?(letter)\n hash[letter] += 1\n end\n end\n #Sort based on key then find max based on value\n #It returns as array [key, value]. so we take the 1st index:\n hash.sort_by {|key, value| key}.max_by {|key, value| value}[0]\n # could also use .last method after sort to find max\nend",
"def most_common_vowel(string)\n sorted = string.chars.sort\n hsh = Hash.new(0)\n vowels = %w(a e i o u)\n sorted.each do |ch|\n if vowels.include?(ch)\n hsh[ch] += 1\n end\n end\n\n hsh.sort_by { |vowel, num| num }.last[0]\nend",
"def find_last_vowel (word)\n last_index = word.length\n word.split('').each.with_index do |char, index|\n if is_vowel?(char)\n last_index = index\n end\n end\n # Return index 0 if no vowel is found\n return last_index\n end",
"def most_common_vowel(string)\n vowels = \"aeiou\"\n common_vowels = Hash.new(0)\n\n string.each_char do |char| \n if vowels.include?(char)\n common_vowels[char] += 1\n end\n end\n \n sorted_vowels = common_vowels.sort_by { |k, v| k}\n if sorted_vowels[0][0] < sorted_vowels[1][0] && sorted_vowels[0][1] == sorted_vowels[1][1]\n return sorted_vowels[0][0]\n end\n sorted_vowels[1][0]\nend",
"def high x \n letters = ('a'..'z').to_a\n indexes = (1..26).to_a\n obj = letters.zip(indexes)\n highest_count = 0\n highest_word = ''\n\n word_arr = x.split(' ')\n word_arr.each do |word|\n current_count = 0\n letter_arr = word.split('')\n letter_arr.each do |l|\n obj.each do |o|\n if l == o[0]\n current_count += o[1]\n end\n end\n end\n if current_count > highest_count\n highest_count = current_count\n highest_word = word \n end\n end\n return highest_word\nend",
"def LongestWord(sen)\n words = sen.split(' ').map do |i|\n /[a-zA-Z0-9]+/.match(i)\n end\n\n longest = words.max_by.each do |i|\n i.to_s.length\n end\n\n longest\n\nend",
"def max_letter_frequency_per_word(sentence)\n\tnumbers_larger_than(letter_per_word(words_longer_than(sentence, 3), \"e\"))\nend",
"def find_longest_word(sentence)\n # removes special characters | sorts by length | reverses to start with the longest\n longest = sentence.split(/\\W+/).sort_by { |word| word.length }.reverse!\n longest[0]\nend",
"def get_the_shortest_word(str)\n words = str.split()\n return words.max\nend",
"def max_consonant_value(s)\n s.scan(/[^aeiou]+/).map {|ss| ss.sum - (ss.size * 96)}.max\nend",
"def highest_scoring_word(words)\n sorted_words = words.sort_by { |word| word.length }\n\n possibles = sorted_words.group_by { |word| score(word) }.max[1]\n return possibles.find { |w| w.length == 7 } if possibles.any? { |word| word.length == 7}\n possibles.first\n end",
"def most_frequent_letter(string)\nend",
"def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend",
"def highest_scoring_word\n highest_scoring_word = Scrabble::Scoring.highest_score_from(@array_of_words)\n\n return highest_scoring_word\n end",
"def longest_word(sentence)\n words = sentence.split\n words.sort_by!(&:length)\n words[-1]\nend",
"def highestRemainLetterOf word\n word.gsub!('*','.').downcase!\n @incorrectWord = @missingWord - word.chars\n getHighestAbilityLetterFrom(Regexp.compile('^'+word+'$')).pop[0]\nend",
"def find_longest_word(sentence)\n words = sentence.downcase.tr(\"^a-z\", \" \").split\n longest = \"\"\n words.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\n\nend",
"def high(x)\r\n x.split.max_by{|x| score_word(w)} end",
"def get_most_used_letter(word)\n\t\tletter_counts = Hash.new(0)\n\t\tword.each do |letter|\n\t\t\tletter_counts[letter] += 1\n\t\tend\n\n\t\tmax_letter = \"\"\n\t\tmax_letter_count = 0\n\t\tletter_counts.each do |letter, count| \n\t\t\tif(count > max_letter_count)\n\t\t\t\tmax_letter_count = count\n\t\t\t\tmax_letter = letter\n\t\t\tend\n\t\tend\n\n\t\tmax_letter\t\t\n\tend",
"def find_the_most_letter_a(array)\n most_as = 0\n most_as_string = \"\"\n array.each_with_index do |string,i|\n a = 0\n string.each_char do |char|\n if char.downcase == \"a\"\n a +=1\n end\n end\n if a > most_as\n most_as = a\n most_as_string = array[i]\n end\n\n end\n most_as_string\nend",
"def highest_scoring_word\n word = Scrabble::Scoring.highest_score_from(plays)\n return word\n end",
"def most_common_word_in_afterthoughts\n arr = self.words_in_afterthoughts\n\n counts= arr.uniq.map { |x| [x, arr.count(x)] }.to_h\n\n most_common = counts.max_by do |word,count|\n count\n end\n\n most_common[0]\n\n end",
"def LongestWord(sen)\n arr = sen.split(' ')\n longest = arr[0]\n arr.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\nend",
"def solve(s)\n s.split(/[aeiou]/).map{ |x| x.sum - x.size * 96 }.max\nend",
"def LongestWord(sen)\n\tarr = sen.gsub(/[^a-zA-Z]+/m, ' ').strip.split(\" \")\n\tcounter = \"\" \n\t\tarr.each do |word|\n\t\t\tif word.length >= counter.length \n\t\t\t\tcounter = word \n\t\t\tend\n\t\tend\n\t\tcounter\nend",
"def longest_word(sentence)\n words = sentence.split(\"\\s\")\n \n max_word = nil\n for word in words do\n if max_word == nil \n max_word = word\n elsif word.length > max_word.length \n max_word = word\n end\n end\n \n return max_word\nend",
"def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend",
"def LongestWord(sen)\n arr = sen.split(\" \")\n arr.sort! { |a, b| b.length <=> a.length }\n arr[0]\n\nend",
"def longest_word(sen)\n words = sen.split\n words.map! { |word| word.delete('^A-Za-z1-9_\\'') }\n longest = words.first\n words.each_with_index do |word, idx|\n next if idx >= words.size - 1\n longest = longest.size < words[idx + 1].size ? words[idx + 1] : longest\n end\n longest\nend",
"def LetterCountI(str)\n largest_count = 0\n words = str.split(\" \")\n i = 0\n while i < words.length\n if count(words[i]) > largest_count\n largest_count = count(words[i])\n largest_word = words[i]\n end\n i += 1\n end\n if largest_count == 0\n return -1\n else\n return largest_word\n end\nend",
"def afterthought_most_words\n self.afterthoughts.max_by do |afterthought|\n afterthought.thoughts.length\n end\n end",
"def high(sentence)\n alpha_score = (\"a\"..\"z\").zip(1..26).to_h\n arr_sentence = sentence.split\n \n score_array = []\n \n arr_sentence.each do |word|\n score = 0\n word.chars.each do |char|\n score += alpha_score[char]\n end\n score_array << score\n end\n score_of_words = arr_sentence.zip(score_array).to_h\n \n result = score_of_words.max_by {|k,v| v}\n result.first\nend",
"def max_position\n @words.first[1].length\n end",
"def highest_scoring_word\n \tScoring.highest_score_from(@words_played)\n end",
"def highest_scoring_word\n return Scrabble::Scoring.highest_score_from(@plays)\n end",
"def highest_word_score\n word = highest_scoring_word\n highest_score = Scrabble::Scoring.score(word)\n return highest_score\n end",
"def solve(s)\n alphabet = ('a'..'z').to_a\n s.gsub(/[aeiou]/, ' ').split.map { |l| l.chars.map { |i| alphabet.index(i) + 1 }.sum }.max\nend",
"def max_consonant_value_x(s)\n s.split(/[aeiou]/).map {|ss| ss.sum - (ss.length * 96)}.max\nend",
"def word_with_most_repeats(sentence)\n result = \"\"\n max = 0\n sentence.split(' ').each do |word| \n repeats = repeat_letter_count(word) \n if repeats > max\n max = repeats\n result = word\n end\n end\n result\nend",
"def longest_word(sentence)\n\t\n\tarr = sentence.split(\" \")\n\tarr = []\n\tlongest = \"\"\n\t\n\tarr.each do |word|\n\tlongest = word if longest.length < word.length\t\n end\n return longest\nend",
"def word_with_most_repeats(sentence)\nend",
"def LetterCountI(str)\n greatest = \"\"\n\n str.downcase.split(\" \").each do |i|\n if (i.chars.length - i.chars.uniq.length) > (greatest.chars.length - greatest.chars.uniq.length)\n greatest = i\n end\n end\n\n greatest.length > 0 ? greatest : -1\nend",
"def highest_word_score\n return Scrabble::Scoring.score(highest_scoring_word)\n end",
"def longest_word(sentence)\nend",
"def longest_word(sentence)\nend",
"def find_longest_word(input)\n array = input.split(\" \")\n array.sort! { |x, y| y.length <=> x.length }\n array[0]\nend",
"def highest_scoring_word\n Scoring.highest_score_from(plays)\n end",
"def longest_word(sentence)\n longestWord = \"\" #holds word\n words = sentence.split(' ') #split sentence into array of words.\n\n words.each do |word| #loop through array of words\n if word.length > longestWord.length #if the word the loop is on is greater than the longest word.. \n longestWord = word #set the longest word to that word.\n end\n end\n return longestWord #return longest word\nend",
"def highest_word_score\n Scoring.score(highest_scoring_word)\n end",
"def LongestWord(sen)\n str = sen.split(\" \")\n longest_word = str[0]\n str.each do |word|\n word.sub(/[\\w\\s]/, '')\n if longest_word.length < word.length\n longest_word = word\n end\n end\n longest_word\nend",
"def solve(string)\n vowels = 'aeiou'\n string_of_chars = string.chars\n \n count = 0\n counted = []\n \n string_of_chars.each do |char|\n if vowels.include?(char)\n count += 1\n else\n count = 0\n end\n counted << [count]\n end\n counted.max.first\n end",
"def LongestWord(str)\n words = str.split.map { |s| s.gsub(/\\W/, '') }\n longest = words [0]\n words.each { |word| longest = word if word.length > longest.length }\n longest\nend",
"def get_the_longest_word(str)\n str.split(\" \").sort! {|s, l| l.length <=> s.length}[0]\nend",
"def longest_word(sentence)\n result = \"\"\n sentence.split.each do |word|\n if word.length > result.length\n result = word\n end\n end\nresult\nend",
"def longest_pause(sentence)\n words = sentence.split(' ')\n longest_um = \"\"\n\n words.each do |word|\n if word[0] == 'u' && word[1] == 'm'\n word.each_char do |char|\n if char != 'u' || char != 'm'\n break\n end\n end\n \n end\n end\n return longest_um.length\nend",
"def longest_word(sentence)\n\tarr = sentence.split(\" \")\n\tp arr\n\titer = 0\n\twhile iter < arr.length\n\t\tlongest_word = nil\n\t\tcurrent_word = arr[iter]\n\t\tif longest_word == nil\n\t\t\tlongest_word = current_word\n\t\telsif longest_word.length < current_word.length\n\t\t\tlongest_word = current_word\n\t\tend\n\t\titer+=1\n\tend\n\treturn longest_word\nend",
"def find_longest_word(string)\n array = string.split(\" \")\n p array\n array.max_by(&:length) \nend",
"def word_with_most_repeats(sentence)\n\nend",
"def word_with_most_repeats(sentence)\n\nend",
"def word_counter(string)\n array = string.downcase.split(\" \")\n word_count = array.count\n the_count = array.count(\"the\")\n\n # option 1 for getting longest work\n # longest_word = \"\"\n # array.each do |x|\n # longest_word = x if longest_word.length < x.length\n # end\n\n # option 2 for getting longest word\n longest_word = array.max_by { |x| x.length }\n\n puts \"The number of words is #{word_count}, the longest word is #{longest_word}, and 'the' is used #{the_count} times.\"\nend",
"def LongestWord(sen)\n longest = \"\"\n sen.scan(/\\w+/) do |word|\n if word.length > longest.length\n longest = word\n end\n end\n \n return longest\nend",
"def find_longest_word(sentence)\n words = sentence.split\n # x = 0\n # y = words[x]\n z = words[0]\n\n words.each do |word|\n\n if word.length > z.length\n z = word\n end\n # x += 1\n end\n z\nend",
"def most_frequent_word(str)\n frqWrd = \"\"\n words = word_count(str)\n words.each do |key|\n frqWrd = key if words[key] >= words[frqWrd]\n end\n frqWrd[0]\nend",
"def longest_string(list_of_words)\n list_of_word = list_of_words.sort_by { |x| x.length }\n return list_of_word[-1]\nend",
"def longest_word(sentence)\n word_arr = sentence.split\n longest = word_arr.shift\n \n word_arr.each do |word|\n longest = word if word.length >= longest.length\n end\n\n longest\nend",
"def highest_word_score\n return highest_scoring_value = Scrabble::Scoring.score(highest_scoring_word)\n end",
"def letter_per_word(array,letter)\n array.max\nend",
"def votes_count_localized_word(record)\n votes_count_in_words(record).split(' ').last\n end",
"def longest_word(sentence)\n words = sentence.split(\"\") #This automically creates a new array with the string split already right?\n idx = 0\n # initially the longest word is empty\n \n longest_w = ''\n \n # We will loop over the current word.\n \n while idx < words.length\n if (words[idx].length > longest_w.length)\n longest_w = words[idx]\n else \n longest_w = longest_w\n end\n \n idx = idx + 1\n end\n \n return longest_w\nend",
"def highest_word_score\n Scrabble::Scoring.score(Scrabble::Scoring.highest_score_from(@plays_array))\n end",
"def most_common_word\n if word_counts.size == 0\n WordCount.new(:word=>'n/a',:count=>0)\n else\n sort_word_counts\n word_counts.to_a[0]\n end\n end",
"def longest_word(string_of_words)\n\tas_arr = string_of_words.split(\" \")\n\tlengths = as_arr.map {|string| string.length}\n\tmax_length = lengths.max\n return as_arr.reverse.detect {|string| string.length === max_length}\nend",
"def index_of_most_recently_found_word\n if @word_index.values.max == nil\n return -1\n else\n return @word_index.values.max\n end\n end",
"def get_the_longest_word(str)\n words = str.split()\n longest = [0, \"\"]\n\n for word in words\n if word.length > longest[0]\n longest[0] = word.length\n longest[1] = word\n end\n end\n\n print(longest[1])\n return longest[1]\nend",
"def high(string)\n letter_scores = ('a'..'z').to_a\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores.index(char}\n score \n end\n words[word_scores.index(word_scores.max)]\nend",
"def first_vowel_word(word)\n vowels = \"aeiou\"\n word.each_char.with_index do |ch, idx|\n if vowels.include?(ch)\n return word[idx..-1]\n end\n end\n\n return word\nend",
"def longest_string(arr)\n arr.max_by { |word| word.length }\nend",
"def longest_word(string)\n\t\n\tsplitted_string = string.split(\" \")\n\tword_length = []\n\t\n\tsplitted_string.each { |word| word_length << word.length }\n\t\n\tmax = word_length.max\n\tidx = word_length.index(max)\n\tsplitted_string[idx]\n\t\nend",
"def find_longest_word(string)\n sentence = string.split\n longest_word = \"\"\n sentence.each do |word|\n word.gsub!(/\\W/, \"\") # filters out non alphanumeric\n longest_word = word if word.length >= longest_word.length\n end\n longest_word\nend",
"def longest_unique_word(arr)\n unique_array = []\n\n arr.each do |word|\n # pass the word to the unique_letters method\n if unique_letters(word)\n # if the word is unique, add it to the array\n unique_array << word\n end\n end\n\n # return the element with most length from the sorted array of unique words\n unique_array.sort.max_by(&:length)\n end",
"def highest_word_score\n \t@scores_array.max\n end",
"def longest_word_in_array(array)\n array.max_by{|word|word.length}\nend"
] | [
"0.8664968",
"0.8269816",
"0.82411313",
"0.8125318",
"0.8087403",
"0.7851711",
"0.78452533",
"0.77639204",
"0.7598772",
"0.7574426",
"0.7509496",
"0.74968374",
"0.74751735",
"0.7403814",
"0.7321625",
"0.7232883",
"0.7216693",
"0.71875465",
"0.71827126",
"0.71494734",
"0.70960504",
"0.70176417",
"0.68784183",
"0.68458897",
"0.6835685",
"0.6816319",
"0.68155396",
"0.67865306",
"0.6763296",
"0.6748521",
"0.6719314",
"0.6703062",
"0.66832554",
"0.6679201",
"0.66580164",
"0.662097",
"0.6616234",
"0.6588659",
"0.6584497",
"0.65647197",
"0.65558195",
"0.6518095",
"0.65142655",
"0.65139526",
"0.65001637",
"0.6493193",
"0.6491126",
"0.64832205",
"0.6475315",
"0.6466848",
"0.6439215",
"0.6435258",
"0.6432809",
"0.64317966",
"0.6426522",
"0.64232475",
"0.6421621",
"0.6419616",
"0.64081305",
"0.6408118",
"0.63947964",
"0.6394703",
"0.6394703",
"0.63934356",
"0.63898903",
"0.63805467",
"0.6379427",
"0.63780963",
"0.63735163",
"0.637101",
"0.6370386",
"0.63602096",
"0.6355362",
"0.63552016",
"0.63509375",
"0.63490236",
"0.63490236",
"0.6340162",
"0.6328768",
"0.6317187",
"0.63157284",
"0.6288724",
"0.6281976",
"0.627503",
"0.6274742",
"0.62738585",
"0.62707835",
"0.6270203",
"0.6254152",
"0.62476766",
"0.6247034",
"0.6239626",
"0.6228777",
"0.6216859",
"0.6214075",
"0.62066483",
"0.62056136",
"0.6201707",
"0.6197533",
"0.6193616"
] | 0.80791146 | 5 |
Instance Methods Formats a nice string version of the skill object. For a regular html app this would be handled at the display layer but when building up JSON/XML strings I usually prefer skipping the view layer and rendering json straight from the controller This method is not currently used | def to_s
(name.blank?) ? description : "#{name}: #{description}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_skill_name\n \"#{skill_category} > #{skill_subcategory} > #{skill_description}\"\n end",
"def name\n\t\[email protected]_s\n\tend",
"def categorized_specific_skill\n return \"#{skill_category.description} : #{specific_skill}\"\n end",
"def show\n @skill = Skill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill }\n end\n end",
"def show\n render json: @skill\n end",
"def skills_display_label\n ret = ''\n self.skills.each do |s|\n ret += \"<span class='label label-default label-type-1'>#{s.name}</span>\"\n end\n\n return ret\n end",
"def to_s\n \"\\nName: #{name}\\nRace: #{race}\\nHit Points: #{hit_points}\\nWeapons: #{weapons}\\nGold: #{gold}\\nClothing: #{clothing}\\n\"\n end",
"def show\n @skill_tag = SkillTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @skill_tag }\n end\n end",
"def json(obj)\n obj.to_json.html_safe\n end",
"def json(obj)\n obj.to_json.html_safe\n end",
"def show\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_skill }\n end\n end",
"def show\n @mostsmallskill = Mostsmallskill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallskill }\n end\n end",
"def show\n render json: @skill_user_profile\n end",
"def to_s\n\t\ts = \"Info:\\n\"\n\t\tindent = ' '\n\t\ts += \" Player Name: \\\"#{@player_name.gsub(/\"/,'\\\"')}\\\"\\n\"\n\t\ts += \" Character Name: \\\"#{@name.gsub(/\"/,'\\\"')}\\\"\\n\"\n\t\ts += \" Created: #{@date_created}\\n\"\n\t\ts += \" Race: #{@race}\"\n\t\ts += \"#{\"\\n Subrace: \\\"#{@subrace.gsub(/\"/,'\\\"')}\\\"\" if subrace != ''}\\n\"\n\t\ts += \" Class: #{@character_class}\\n\"\n\t\ts += \" Primary School: \\\"#{@primary.gsub(/\"/,'\\\"')}\\\"\\n\"\n\t\ts += \" Secondary School: \\\"#{@secondary.gsub(/\"/,'\\\"')}\\\"\\n\"\n\t\ts += @death_history.to_s\n\t\ts += @spirit_effects.to_s\n\t\ts += @body_effects.to_s\n\t\ts += @build.to_s\n\t\ts += @experience.to_s\n\t\ts += \"Backstory: >\\n \"\n\t\ts += @backstory.split(\"\\n\").join(\"\\n\\n \").split('. ').join(\".\\n \")\n\t\treturn s\n\tend",
"def show\n @skill = @user.skills.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @skill }\n end\n end",
"def show\n @skill = @user.skills.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @skill }\n end\n end",
"def skills_view(skills)\n skills.map { |skill| skill_view(skill) }\n end",
"def show\n @skillinstance = Skillinstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skillinstance }\n end\n end",
"def show\n render json: @admin_skill\n end",
"def to_s\t\n\t\t\tto_return = ''\n\t\t\[email protected] { \n\t\t\t\t|item|\n\t\t\t\tto_return = item.to_s\n\t\t\t}\n\t\t\tto_return \n\t\tend",
"def skills\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def to_s\n\n # Compile a string for the cleric's orisons\n orisons = \"Orisons: \\n\"\n if @orisons.empty?\n orisons += \"None \\n\"\n else\n @orisons.each do |orison|\n orisons += \"#{orison.capitalize} \\n\"\n end\n end\n\n # Compile a string for the cleric's spells\n spells = \"Level 1 Spells: \\n\"\n if @spells.empty?\n spells += \"None \\n\"\n else\n @spells.each do |spell|\n spells += \"#{spell.capitalize} \\n\"\n end\n end\n\n partialString = super\n\n fullString = \"#{partialString}#{orisons}\\n#{spells}\"\n\n return fullString\n\n end",
"def show\n @skill_set = SkillSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill_set }\n end\n end",
"def render_tech\n object.render_tech * \", \"\n end",
"def to_s\n '<Twilio::REST::Preview::Understand>';\n end",
"def to_s\n \"#{user} Reading #{book}\\nMood: #{mood}\\nLocation: #{location}\\nThoughts:#{thoughts}\"\n end",
"def description\n return $BlizzABS.util.add_skill_text(@description, @id, 2)\n end",
"def show\n @individual_skill_record = IndividualSkillRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @individual_skill_record }\n end\n end",
"def add_skill_text(text, id, type)\n # return normal text if range is 0 or the option isn't used for this type\n return text if Skills.range(id) == 0\n # get scope\n scope = $data_skills[id].scope\n # iterate through configuration\n Config::SKILL_DATA_MODE.each_index {|i|\n # if current option was set up for this type\n if Config::SKILL_DATA_MODE[i] == type\n # add extra information to result text\n case i\n when 0\n next if scope == 0 || scope == 7\n text += case Skills.type(id)[0]\n when SHOOT then Cache::ScopeOne.include?(scope) ? ' (Shooter)' : ' (Thruster)'\n when HOMING then Cache::ScopeOne.include?(scope) ? ' (Homing)' : ' (S. Homing)'\n when DIRECT then Cache::ScopeOne.include?(scope) ? ' (Selector)' : ' (Shockwave)'\n when BEAM then Cache::ScopeOne.include?(scope) ? ' (Beam)' : ' (Fullscreen)'\n when TRAP then ' (Trap)'\n when TIMED then ' (Timed)'\n when SUMMON then ' (Summoner)'\n end\n when 1 then text += ' (explodes)' if Skills.type(id)[1] > 0\n when 2\n number = Skills.range(id)\n number = 1.0 if number < 1.0\n text += \" R: #{number}\"\n end\n end}\n # return result text\n return text\n end",
"def to_s\n \"#{self.class.name} #{@json_dict}\"\n end",
"def string\n JSON.fast_generate(@workflow)\n end",
"def to_s\r\n pretty_output\r\n end",
"def to_s()\n prettify()\n end",
"def to_s\n resp = \"\\nNombre: #{name} \\tNivel: #{combat_level}\"\n if(level_change_against_cultist_player != 0)\n resp += \"\\nNivel contra sectarios: \" + get_level_change_against_cultist_player.to_s\n end\n \n resp += \"\\nNiveles que ganas: #{get_levels_gained}\" + \n \"\\tTesoros que ganas: #{get_treasures_gained}\" +\n \"\\nMal rollo: \" + bad_consequence.to_s\n end",
"def show\n @skill = Skill.find(params[:id])\n\t\tauthorize! :read, Skill\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill }\n end\n end",
"def create\n @issue_skill = IssueSkill.new(issue_skill_params)\n @issue_skill.save\n render json: @issue_skill\n\n # respond_to do |format|\n # if @issue_skill.save\n # format.html { redirect_to @issue_skill, notice: \"Issue skill was successfully created.\" }\n # format.json { render :show, status: :created, location: @issue_skill }\n # else\n # format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @issue_skill.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def to_s()\r\n\t\tres = \"Printing Statistic -#{self.object_id}-\\n\\t\"\r\n\t\tres += \" - Time : #{@time}\\n\\t\"\r\n\t\tres += \" - Penalty : #{@penalty}\\n\\t\"\r\n\t\tres += \" - isFinished : #{@isFinished}\\n\\t\"\r\n\t\tres += \" - Used help : #{@usedHelp}\\n\\t\"\r\n\t\tres += \" - Nb Stars : #{@numberOfStars}\\n\\t\"\r\n\t\tres += \" - NbClick : #{@nbClick}\\n\\t\"\r\n\t\treturn res\r\n\tend",
"def to_s\n\t\t\tstr = super() + \"\\n\"\n\t\t\tstr += \"\\tAppaleable? #{appaleable}\\n\" if appaleable\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tLocation: #{location}\\n\" if location\n\t\t\tstr += \"\\tDisapproved text: #{disapproved_text}\\n\" if disapproved_text\n\t\t\tstr += \"\\tReason code: #{reason_code} (see: http://msdn.microsoft.com/en-US/library/bing-ads-editorialfailurereasoncodes.aspx)\\n\" if reason_code\n\n\t\tend",
"def show\n @skill_level = SkillLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @skill_level }\n end\n end",
"def to_s\n return \"Name: #{@first_name} #{@last_name}\\nAge: #{@age}\\nHair Color: #{@hair_color}\\nEye Color: #{@eye_color}\"\n end",
"def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend",
"def full_name_with_skills\n self.full_name + ' ' + self.all_skills_with_hashtags\n end",
"def to_s\n \"Name = #{@name}\\nLevel = #{@combatLevel}\\nCultist Change Level = #{@levelChangeAgainstCultistPlayer}\\nPrize = [\" + @prize.to_s + \"] \\nBad Consequence = \" + @badCons.to_s() + \"\\n\"\n end",
"def to_s\r\n \"Hello I'm #{@name} with a health of #{@health} and have a score of #{score}.\"\r\n end",
"def to_s\n render().join \"\\n\"\n end",
"def show\n @skills = @warrior.skills\n @equipment_list = @warrior.equipment_lists\n @equipment = @warrior.equipments\n @armours = @warrior.armours\n @weapons = @warrior.weapons\n # render :json => @warrior, :include => [:skills, :equipment_lists, :equipments, :armours, :weapons]\n render json: {\n warrior: @warrior,\n skills: @skills,\n equipment: @equipment,\n weapons: @weapons,\n armours: @armours,\n status: 200}\n end",
"def display_str\n \"#{objective.code} - #{short_desc}\"\n end",
"def to_s()\n desc = \"person(\" + @id.to_s() + \",\" + @name\n if (@style != \"\")\n desc += \",\" + @style\n end\n desc += \",\" + @allegiance.to_s()\n desc += \",\" + @faction.to_s()\n desc += \",\" + @faction_for_chapter.to_s()\n if (@note != \"\")\n desc += \",\" + @note\n end\n desc += \")\"\n return desc\n end",
"def matched_skill\n text = ''\n counter = 0.0\n skills = self.member.skills\n \n if self.job.present?\n self.job.skills.each do |s|\n if skills.include? s\n text += \"<span class='mb-5 label label-info'>#{s.name}</span>\"\n counter += 1\n end\n end\n\n if counter > 0\n percent = (counter/self.job.skills.count*100).to_i \n else\n percent = 0\n end\n end\n\n return { percent: percent, text: text }\n end",
"def show\n @skill_suggestion = SkillSuggestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill_suggestion }\n end\n end",
"def index\n @skills = Skill.all\n\n render json: @skills\n end",
"def to_s\n JSON.pretty_generate(@json)\n end",
"def to_s\n Alf::Renderer.text(self).execute(\"\")\n end",
"def to_s\n \"Name = #{@name}\\nGold Coins = #{@goldCoins}\\nMinimum Bonus = #{@minBonus}\\nMaximum Bonus = #{@maxBonus}\\nKind of the Treasure = #{@kind.upcase}\"\n end",
"def render_plain\n short_category(object.action) << \"\\n\" << instance_attributes\n end",
"def pretty_generate\n JSON.pretty_generate( self.to_h )\n end",
"def to_pretty\n to_s(:prettyprint => true)\n end",
"def to_s\n \"{ name: #{ @name }, age: #{ @age } }\"\n end",
"def create\n skill = Skill.new(skill_params)\n \n if skill.save\n render json: {status: 'SUCCESS', message:'Saved skill', data:skill},status: :ok\n else\n render json: {status: 'ERROR', message:'Skill not saved', data:skill.errors},status: :unprocessable_entity\n end\n end",
"def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.FlexApi.V1.InsightsQuestionnairesContext #{context}>\"\n end",
"def create\n @skill = Skill.new(params[:skill])\n\n respond_to do |format|\n if @skill.save\n format.html { redirect_to @skill, notice: 'Skill was successfully created.' }\n format.json { render json: @skill, status: :created, location: @skill }\n else\n format.html { render action: \"new\" }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render\n # need to return the following like this\n # 1) font_size as font-size \n # 2) dot_size as dot-size\n # 3) outline_colour as outline-colour\n # 4) halo_size as halo-size\n # 5) start_angle as start-angle\n # 6) tick_height as tick-height\n # 7) grid_colour as grid-colour\n # 8) threed as 3d\n # 9) tick_length as tick-length\n # 10) visible_steps as visible-steps\n # 11) key_on_click as key-on-click\n returning self.to_json2 do |output|\n output.gsub!(\"threed\",\"3d\")\n %w(font_size dot_size outline_colour halo_size start_angle tick_height grid_colour tick_length no_labels label_colour gradient_fill fill_alpha on_click spoke_labels visible_steps key_on_click).each do |replace|\n output.gsub!(replace, replace.gsub(\"_\", \"-\"))\n end\n end\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def to_s\n %Q{\n ---------------------------------------------------------\n Your strength is #{@strength}.\n You have $#{@wealth}.\n Your provision sack holds #{@food} units of food.\n ---------------------------------------------------------\n }\n end",
"def convert_all_skill\n item_json = @data.collect { |item| convert_single_skill(item) }\n return item_json\n end",
"def to_string\n render().join \"\\n\"\n end",
"def to_s\n @textual_representation ||= (\n \"Action: #{@name}\\r\\nActionID: #{@action_id}\\r\\n\" +\n @headers.map { |(key,value)| \"#{key}: #{value}\" }.join(\"\\r\\n\") +\n (@headers.any? ? \"\\r\\n\\r\\n\" : \"\\r\\n\")\n )\n end",
"def to_text\r\n result = ''\r\n\r\n # Render the player with the most improved batting average.\r\n player = self[:most_improved_batting_avg_2010]\r\n result << \"Most Improved Batting Avg from 2009 to 2010: #{player_label(player)}\\n\"\r\n result << \" 2009 average: #{'%.3f' % player[:prev_batting_avg].to_f}\\n\"\r\n result << \" 2010 average: #{'%.3f' % player[:batting_avg].to_f}\\n\"\r\n\r\n # Render the slugging percentages.\r\n result << \"\\nOakland Athletic's 2007 Slugging Percentages:\\n\"\r\n players = self[:slugging_percentages_Oakland_As_2007]\r\n sorted_players = players.sort_by { |p| [1000.0 - p[:slugging_perc], p[:last_name].to_s, p[:first_name].to_s, p[:player_id].to_s] }\r\n sorted_players.each do |plyr|\r\n formatted_perc = '%5.1f%%' % plyr[:slugging_perc]\r\n result << \" #{formatted_perc} #{player_label(plyr)}\\n\"\r\n end\r\n\r\n # Render the triple crown winners.\r\n result << \"\\nTriple Crown Winners:\\n\"\r\n winners = self[:triple_crown_winners]\r\n sorted_winners = winners.sort_by { |p| [p[:year].to_s, p[:league].to_s] }\r\n sorted_winners.each do |winner|\r\n player = winner[:player]\r\n player_lbl = player ? player_label(player) : '(No winner)'\r\n result << \" #{winner[:year]} -- #{winner[:league]}: #{player_lbl}\\n\"\r\n end\r\n\r\n result\r\n end",
"def show\n @crew_member_skill = CrewMemberSkill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crew_member_skill }\n end\n end",
"def to_s\r\n case format\r\n when :json then to_json\r\n when :xml then to_xml\r\n else inspect\r\n end\r\n end",
"def to_s\n \"#{@text}: #{@context}\"\n end",
"def show\n @skill_tag = SkillTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @skill_tag }\n end\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n render\n end",
"def to_s\n\n #Compile string for starting bonuses\n startBon = \"Starting Bonuses: \\n\"\n if @startingBonuses.empty?\n startBon += \"None \\n\"\n else\n @startingBonuses.each do |name, value|\n startBon += \"Initial +#{value} bonus to #{name} \\n\"\n end\n end\n\n #Compile a string for level bonuses\n levBon = \"Level Bonuses: \\n\"\n if @levelBonuses.empty?\n levBon += \"None \\n\"\n else\n @levelBonuses.each do |name, value|\n levBon += \"+#{value} #{name} per level \\n\"\n end\n end\n\n #Compile a string for abilities, scores, and modifiers\n abil = \"Ability Score Modifier \\n\" +\n \"Strength #{@strength.ptScore} #{@strength.modifier} \\n\" +\n \"Dexterity #{@dexterity.ptScore} #{@dexterity.modifier} \\n\" +\n \"Constitution #{@constitution.ptScore} #{@constitution.modifier} \\n\" +\n \"Intelligence #{@intelligence.ptScore} #{@intelligence.modifier} \\n\" +\n \"Wisdom #{@wisdom.ptScore} #{@wisdom.modifier} \\n\" +\n \"Charisma #{@charisma.ptScore} #{@charisma.modifier} \\n\"\n\n #Compile a string for saving throws\n savThrows = \"Saving Throws: \\nFortitude Save: #{@fortitudeSave} \\nReflex Save: #{@reflexSave} \\n\" +\n \"Will Save: #{@willSave} \\n\"\n\n #Compile a string for immunities\n immunities = \"Immunities: \\n\"\n if @immunities.empty?\n immunities += \"None \\n\"\n else\n @immunities.each do |val|\n immunities += \"#{val.capitalize} \\n\"\n end\n end\n\n #Compile a string for attack bonuses vs monsters\n bonVsMonster = \"Attack Bonuses vs. Monsters: \\n\"\n if @attackBonuses.empty?\n bonVsMonster += \"None \\n\"\n else\n @attackBonuses.each do |creature, bonus|\n bonVsMonster += \"+#{bonus} attack bonus against #{creature}s \\n\"\n end\n end\n\n #Compile a string for defense bonuses\n defBonuses = \"Defense Bonuses: \\n\"\n if @defenseBonuses.empty?\n defBonuses += \"None \\n\"\n else\n @defenseBonuses.each do | entity, bonus |\n defBonuses += \"+#{bonus} defense bonus against #{entity}s \\n\"\n end\n end\n\n #Put together all combat data into a string\n combatData = \"Combat Data: \\nHP: #{@hp} \\nSpeed: #{@speed}ft \\nDarkvision Range: #{@darkvisionRange}ft \\n\\n\" +\n \"#{immunities}\\nAttack Bonus Modifier: #{@attackBonus} \\n\\n#{bonVsMonster}\\n#{defBonuses}\"\n\n #Compile a string for equipment proficiencies\n equipProf = \"Equipment Proficiencies: \\n\"\n if @equipmentProficiencies.empty?\n equipProf += \"None\"\n else\n @equipmentProficiencies.each do |prof|\n equipProf += \"#{prof.capitalize} \\n\"\n end\n end\n\n #Compile a string for skills\n skills = \"Skills: \\n\"\n if @skills.empty?\n skills += \"None \\n\"\n else\n @skills.each do |skill|\n skills += \"#{skill.capitalize} \\n\"\n end\n end\n\n divider = \"================================================================================\\n\"\n\n #Put all the strings together\n string = \"Character Name: #{@name.capitalize} \\nGender: #{@gender.capitalize} \\nRace: #{@race.capitalize} \\n\" +\n \"Class: #{@className.capitalize} \\nLevel: 1 \\nAlignment: #{@alignment.capitalize} \\nSkill Ranks: #{@skillRanks} \\n\\n\" +\n \"#{levBon}\\n#{startBon}#{divider}#{abil}#{divider}#{savThrows}#{divider}#{combatData}#{divider}\" +\n \"#{equipProf}#{divider}#{skills}#{divider}\"\n\n return string\n\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def create\n @skill = Skill.new(skill_params)\n\n if @skill.save\n render json: @skill, status: :created, location: @skill\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def to_s\n JSON.pretty_generate(raw)\n end",
"def to_s\n to_html\n end",
"def to_s\n return \"#{@name} - #{@description} : #{@rating}\"\n end",
"def view_question_text\n html = '<TR><TD align=\"left\"> '+self.txt+' </TD>'\n html += '<TD align=\"left\">'+self.type+'</TD>'\n html += '<td align=\"center\">'+self.weight.to_s+'</TD>'\n questionnaire = self.questionnaire\n if !self.max_label.nil? && !self.min_label.nil?\n html += '<TD align=\"center\"> ('+self.min_label+') '+questionnaire.min_question_score.to_s+' to '+ questionnaire.max_question_score.to_s + ' ('+self.max_label+')</TD>'\n else\n html += '<TD align=\"center\">'+questionnaire.min_question_score.to_s+' to '+ questionnaire.max_question_score.to_s + '</TD>'\n end\n\n html += '</TR>'\n html.html_safe\n end",
"def to_s\n (\n [\"Score #{sprintf '%0.4f', score}: \" +\n \"#{sprintf '%0.4f', phonetic_coverage} phonetic, \" +\n \"#{sprintf '%0.4f', semantic_coverage} semantic \"] +\n [\"Morphemes (#{morphemes.length})\"] + [\"-\" * \"Morphemes\".length] +\n morphemes.to_a.sort_by {|m| m.transcription} +\n [\"Word List\"] + [\"-\" * \"Word List\".length] +\n word_list\n ).join(\"\\n\")\n end",
"def to_s\n \"#{@name} with a score of #{@health_score}\"\n end",
"def to_s\n s = \"Influence:\"\n s += \"\\n\\tuser_id: \" + user_id.to_s\n s += \"\\n\\tdate: \" + date.to_s\n s += \"\\n\\tacceleration: \" + acceleration.to_s \n s += \"\\n\\tvelocity: \" + velocity.to_s\n s += \"\\n\\taudience: \" + audience.to_s \n s += \"\\n\\tcreated_at: \" + created_at.to_s\n s\n end",
"def to_s\n self.to_array.map{ |hsh| JSON.pretty_generate(hsh) }.join(\"\\n\")\n end",
"def to_s\n p \"Name :#{@animal_name}. Age: #{@age}. Gender: #{@gender}. Species: #{@species}. Most loved toy: #{toys.join(\"\\n \")}. \"\n\n end",
"def to_s\n context = @solution.map {|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Preview.Understand.IntentStatisticsContext #{context}>\"\n end",
"def to_s\n to_json\n end",
"def to_s\n \"<Observation #{self.id}: #{to_plain_s}>\"\n end",
"def new\n @skill = Skill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @skill }\n end\n end",
"def index\n @skills = @user.skills\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @skills }\n end\n end",
"def to_s\n str = \"TimetabledLesson: \"\n str << @schoolday.full_sem_date\n str << \"; \" << @lesson.to_s(:brief)\n str << \"; \" << (@obstacle ? @obstacle.reason : \"nil\")\n str\n end",
"def show\n @create_request_skill = CreateRequestSkill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @create_request_skill }\n end\n end",
"def create\n @myskill = Myskill.new(myskill_params)\n respond_to do |format|\n if @myskill.save\n format.html { redirect_to @myskill, notice: 'Myskill was successfully created.' }\n format.json { render :show, status: :created, location: @myskill }\n else\n format.html { render :new }\n format.json { render json: @myskill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_nice_json\n JSON.pretty_generate to_hash\n end",
"def to_nice_json\n JSON.pretty_generate to_hash\n end",
"def to_s\n %(<#{ @name }#{attributes}>)\n end",
"def to_s\n format\n end",
"def to_s #can use in strings ie instead of #{jimmy.name} we can just use #{jimmy} HOW TO TURN A STUDENT INTO A STRING shortcut\n @name\n end",
"def to_s\n to_json.to_s\n end",
"def to_string\n puts \"*** #{@name} ***\"\n puts \"health: #{@health * 100 / @initial_health}%\"\n puts \"stamina: #{stamina}\"\n puts \"power: #{@initial_power}\"\n puts @is_tired ? \"tired\" : \"not tired\"\n puts @is_dead ? \"dead\" : \"alive\"\n end"
] | [
"0.6501851",
"0.64252216",
"0.6241398",
"0.6191012",
"0.6161062",
"0.600174",
"0.59452826",
"0.58862793",
"0.5874406",
"0.5873727",
"0.58656365",
"0.58524984",
"0.5837649",
"0.5823346",
"0.5822854",
"0.5822854",
"0.58112293",
"0.57857156",
"0.5785015",
"0.5781118",
"0.57784075",
"0.57635784",
"0.57264924",
"0.5707609",
"0.5699928",
"0.56987613",
"0.56925374",
"0.56803614",
"0.56582004",
"0.5624273",
"0.56193805",
"0.56054085",
"0.5598163",
"0.5593349",
"0.558398",
"0.5573629",
"0.5555434",
"0.55457103",
"0.5545684",
"0.5543413",
"0.5539028",
"0.5520107",
"0.5513558",
"0.5503083",
"0.5501028",
"0.54973066",
"0.5491994",
"0.54917735",
"0.54878587",
"0.5483029",
"0.5478331",
"0.54706496",
"0.54682964",
"0.5461766",
"0.54551476",
"0.5453142",
"0.54509157",
"0.544378",
"0.54398286",
"0.543326",
"0.54325557",
"0.541941",
"0.54096425",
"0.5406358",
"0.5405863",
"0.540454",
"0.5402369",
"0.53967744",
"0.5396183",
"0.53952587",
"0.53939956",
"0.5392702",
"0.5390976",
"0.53884006",
"0.5386629",
"0.53766567",
"0.536714",
"0.53650975",
"0.5365062",
"0.53616214",
"0.5359813",
"0.53576434",
"0.53564036",
"0.5353678",
"0.534171",
"0.53406024",
"0.5338568",
"0.5338563",
"0.5329541",
"0.5325773",
"0.5319756",
"0.53166515",
"0.5312566",
"0.5311244",
"0.5306672",
"0.5306672",
"0.5302337",
"0.5298908",
"0.52904016",
"0.5284645",
"0.52820677"
] | 0.0 | -1 |
Is everything good to go? Implemented by subclasses. | def ok?
raise "Subclasses must implement this method."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usable?; end",
"def valid?\n raise NotImplementedError\n end",
"def checks; end",
"def valid?\n raise NotImplementedError\n end",
"def check ; true ; end",
"def check\n \n end",
"def check\n \n end",
"def valid?\n raise \"You must override `valid?' in your class\"\n end",
"def valid?\n return false if !super\n true\n end",
"def valid?\n raise Errors::NotImplementedError\n end",
"def covered?; end",
"def valid?(thing); end",
"def valid?(thing); end",
"def battle_ok?\n fail NotImplementedError\n end",
"def is_compliant()\n\t\tend",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def valid; end",
"def validateHandin()\n updateModules()\n # Partners stand alone, they don't affect others\n if @modulesUsed.include?(\"Partners\") then\n if ! partnersValidateHandin() then\n return false\n end\n end\n \n # If we're validating for svn, we don't have a file to check\n if @modulesUsed.include?(\"Svn\") then\n if ! svnValidateHandin() then\n return false\n end\n else\n if ! super() then\n return false\n end\n end\n return true\n end",
"def valid?\n raise 'Not Implemented'\n end",
"def valid?\n raise Error::MethodShouldBeOverridenByExtendingClassError\n end",
"def certain?\n fail NotImplementedError\n end",
"def check?\n raise NotImplementedError\n end",
"def valid?\n true && super\n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?\r\n return true\r\n end",
"def sos_piedra?() raise NotImplementedError end",
"def ready?\n raise 'Not implemented!'\n end",
"def bad?\n !good?\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def allowed?() raise NotImplementedError end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def is_valid?\n raise \"Not Implemented. Class #{self.class.name} doesn't implement is_valid?\"\n end",
"def hungry?\r\n # methods that return true or false\r\n @stuff_in_belly <= 2\r\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def valid?\n return true\n end",
"def ready?\n raise NotImplementedError\n end",
"def failed?\n raise 'Not implemented!'\n end",
"def valid?\n not_implemented\n end",
"def internal?; end",
"def test_valid?\n base = Tui::Model::Base.new( 'lab1' )\n ex = assert_raise( RuntimeError ) { base.valid?( 1 ); }\n assert_equal( 'Method Tui::Model::Base::valid? not implemented!', ex.message )\n ex = assert_raise( RuntimeError ) { base.value = 1; }\n assert_equal( 'Method Tui::Model::Base::valid? not implemented!', ex.message )\n end",
"def valid?\n return false if @id.nil?\n return false if @title.nil?\n return false if @title.to_s.length < 1\n return false if @image.nil?\n return false if @image.to_s.length < 1\n return false if @image_type.nil?\n return false if @image_type.to_s.length < 1\n return false if @servings.nil?\n return false if @ready_in_minutes.nil?\n return false if @license.nil?\n return false if @license.to_s.length < 1\n return false if @source_name.nil?\n return false if @source_name.to_s.length < 1\n return false if @source_url.nil?\n return false if @source_url.to_s.length < 1\n return false if @spoonacular_source_url.nil?\n return false if @spoonacular_source_url.to_s.length < 1\n return false if @aggregate_likes.nil?\n return false if @health_score.nil?\n return false if @spoonacular_score.nil?\n return false if @price_per_serving.nil?\n return false if @cheap.nil?\n return false if @credits_text.nil?\n return false if @credits_text.to_s.length < 1\n return false if @dairy_free.nil?\n return false if @gaps.nil?\n return false if @gaps.to_s.length < 1\n return false if @gluten_free.nil?\n return false if @instructions.nil?\n return false if @ketogenic.nil?\n return false if @low_fodmap.nil?\n return false if @sustainable.nil?\n return false if @vegan.nil?\n return false if @vegetarian.nil?\n return false if @very_healthy.nil?\n return false if @very_popular.nil?\n return false if @whole30.nil?\n return false if @weight_watcher_smart_points.nil?\n return false if !@extended_ingredients.nil? && @extended_ingredients.length < 0\n return false if @summary.nil?\n return false if @summary.to_s.length < 1\n true\n end",
"def valid?\n fail NotImplementedError, \"needs to be implemented in appender\"\n end",
"def usable?\n false\n end",
"def enotsup?() super; end",
"def magical?\n fail NotImplementedError\n end",
"def issn; end",
"def hungry? # End with a ? for true/false only methods.\r\n @stuff_in_belly <= 2\r\n end",
"def should; super end",
"def for_all?\n fail NotImplementedError\n end",
"def check\n raise(CheckNotDefined, \"Your subclass must define its own #check.\")\n end",
"def completed?\n raise \"completed? should be implemented by the extending class\"\n end",
"def abstract?; end",
"def check!\n true\n end",
"def valid?\n return false unless name\n return false unless version\n return false unless summary\n #return false unless maintainer\n #return false unless homepage\n true\n end",
"def valid?\n return false if @title_code.nil?\n return false if @_class.nil?\n _class_validator = EnumAttributeValidator.new('String', [\"Other\", \"Absolute\", \"Possessory\", \"Qualified\", \"Good\"])\n return false unless _class_validator.valid?(@_class)\n return false if @tenure.nil?\n tenure_validator = EnumAttributeValidator.new('String', [\"Other\", \"Freehold\", \"Leasehold\"])\n return false unless tenure_validator.valid?(@tenure)\n return false if @commonhold.nil?\n return false if @addresses.nil?\n return false if @is_not_main_title.nil?\n return true\n end",
"def alive?()\n not_implemented()\n end",
"def physical?\n fail NotImplementedError\n end",
"def need_scrapping?\n [email protected]_of?(Festival) || [email protected]? || @festival.should_be_updated?\n end",
"def improve\n return false unless valid?\n true\n end",
"def isSatisfiable?()\n\tend",
"def success?() end",
"def working?\n true\n end"
] | [
"0.6997373",
"0.66970676",
"0.6675866",
"0.6625843",
"0.66135323",
"0.6578524",
"0.6578524",
"0.6531431",
"0.6449139",
"0.64490074",
"0.6425337",
"0.6421146",
"0.6421146",
"0.6418683",
"0.64101654",
"0.6405182",
"0.63839775",
"0.636873",
"0.6362219",
"0.6357812",
"0.63154584",
"0.630707",
"0.6251256",
"0.6222257",
"0.6222257",
"0.6222257",
"0.6222257",
"0.6222257",
"0.61902773",
"0.61899644",
"0.6168662",
"0.61579686",
"0.6153665",
"0.6153665",
"0.6153665",
"0.6153665",
"0.6153665",
"0.6147608",
"0.61201006",
"0.61201006",
"0.61201006",
"0.61201006",
"0.6106084",
"0.6105615",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60963273",
"0.60949725",
"0.6082147",
"0.60770667",
"0.60461414",
"0.6041115",
"0.6040885",
"0.60340106",
"0.6005533",
"0.6002372",
"0.5997418",
"0.59951925",
"0.5994741",
"0.59874934",
"0.59807783",
"0.5979557",
"0.59775555",
"0.5976436",
"0.5969015",
"0.5962661",
"0.59486085",
"0.5946471",
"0.594439",
"0.59429103",
"0.5940299",
"0.5939948",
"0.5932691",
"0.59182405"
] | 0.7621948 | 0 |
Warn, fix, or abort. Implemented by subclasses. | def run
raise "Subclasses must implement this method."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warned; end",
"def warn\n\n end",
"def warning(*args); end",
"def warning(text); end",
"def warning(text); end",
"def warn(*args); end",
"def warn(*args); end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def run_warned; end",
"def lwarn; end",
"def warn(*args)\n self.warned = true\n super\n end",
"def complain\n\n end",
"def warning(string); end",
"def warning(string); end",
"def warn(p0) end",
"def warned=(_arg0); end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warning!\n self.severity = :WARNING\n end",
"def warning(type, message, lineno)\n end",
"def complain something\n puts angry_dude_format something\n end",
"def fix_suggestion\n backup_error_obj.fix_hint rescue 'Please help us debug this error by forwarding this email to [email protected]'\n end",
"def complain_about_bad_flags!\n @complain_about_bad_flags = true\n end",
"def repair!\n raise NotImplementedError\n end",
"def lint(*args); end",
"def fatal; end",
"def fatal?; end",
"def fatal?; end",
"def warn message\n super message if @verbosity > 1\n end",
"def parse_warn(msg); say :warn, msg; end",
"def warning(warning)\n end",
"def warn(*args, &block)\n method_missing(\"warn\", *args, &block)\n end",
"def warn *args\n @invoked = { name: :warn, args: args }\n end",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end",
"def warn(_message)\n raise NotImplementedError.new\n end",
"def warn(check)\n update_check_status(check, 'warn')\n end",
"def warn(*args)\n # eliminate ruby/gem warnings from output\nend",
"def diagnostic; end",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def broken(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n if options[:force]\n puts 'forcing'\n else\n puts 'broken'\n end\n end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def warn?; @level <= WARN; end",
"def warn?; @level <= WARN; end",
"def alert_warning(statement, question=nil)\n @errs.puts \"WARNING: #{statement}\"\n ask(question) if question\n end",
"def bold_warning(*args); end",
"def process_fix\n super\n end",
"def notify_on_errs\n !(super == false)\n end",
"def treat_errors_as_warnings\n @treat_errors_as_warnings ||= true\n end",
"def warn(progname = T.unsafe(nil), &block); end",
"def warn=(value) @warn = true; end",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def warning(msg, ask_continue: true)\n tell \"#{☞} {y{#{msg}}}\"\n exit(-1) if ask_continue && !ask(\"continue\")\n end",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def raise_deprecations; end",
"def faint; end",
"def faint; end",
"def silence_deprecations=(_arg0); end",
"def warning(msg) log(4, msg); end",
"def abort(message)\n warn message\n exit 1\nend",
"def abort(message)\n warn message\n exit 1\nend",
"def raise_deprecations=(_arg0); end",
"def warn(fmt, *args)\n end",
"def warn?\n raise NotImplementedError.new\n end",
"def warning\n state(\"warning\")\n end",
"def exec_fix\n super\n end",
"def broken_method\n this method is broken\nend",
"def warn(message, id: T.unsafe(nil), &block); end",
"def complain(*args)\n raise Failure, *args\n end",
"def error\n\tyield\n\tif @changedConfigDir or @changedConfigFile\n\t\tif @opts[:stealth]\n\t\t\tstealth\n\t\telse\n\t\t\tLog.warn \"Permanent changes to the servers configuration have been made, these will have to be undone to stay hidden\"\n\t\tend\n\tend\n\texit 1\nend",
"def warning(fmt, *args)\n end",
"def warning_state\n super\n end",
"def warning(msg, ask_continue: true)\n tell(colorize(\"☞ \", :magenta) + colorize(msg, :yellow))\n exit(-1) if ask_continue && !quiz(\"continue\")\n end",
"def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end",
"def warn?; @logger.warn?; end",
"def lint\n lint_results\n .reject { |r| r.nil? || r['messages'].length.zero? }\n .reject { |r| r['messages'].first['message'].include? 'matching ignore pattern' }\n .map { |r| send_comment r }\n end",
"def report_warn(type, message)\n @report.warn(type, message)\n end",
"def report_broken\n \"Broken\"\n end",
"def warn( msg )\n @stringio.puts msg\n end",
"def bug\n end",
"def inhibit_all_warnings!\n @target_definition.inhibit_all_warnings = true\n end",
"def warning(string)\n delegate.warning(path, self, string) if delegate.respond_to?(:warning)\n end",
"def untaint()\n bug( \"you must override untaint()\" )\n end",
"def inhibit_all_warnings!\n current_target_definition.inhibit_all_warnings = true\n end",
"def abortWithUsage( msg = \"Aborted.\" )\n\tmsg = msg + Usage\n\tabortRun( msg )\nend",
"def notice; end",
"def warn!(message) #:doc:\n # TODO: log\n nil\n end",
"def abort_if_errors\n unless $warnings.empty?\n STDERR.puts\n STDERR.puts \"The following warnings were generated:\"\n STDERR.puts\n $warnings.each do |w|\n STDERR.puts \"\\tWarning: #{w}\"\n end\n STDERR.print \"\\nAbort program? (y/N) \"\n answer = (gets).chomp.strip.downcase\n $errors << \"Aborted by user\" if answer.size>0 && 'y' == answer[0]\n $warnings = []\n end\n unless $errors.empty?\n STDERR.puts\n STDERR.puts \"Correct the following errors and try again:\"\n STDERR.puts\n $errors.each do |e|\n STDERR.puts \"\\t#{e}\"\n end\n STDERR.puts\n exit(-1)\n end\nend",
"def abort_if_errors\n unless $warnings.empty?\n STDERR.puts\n STDERR.puts \"The following warnings were generated:\"\n STDERR.puts\n $warnings.each do |w|\n STDERR.puts \"\\tWarning: #{w}\"\n end\n STDERR.print \"\\nAbort program? (y/N) \"\n answer = (gets).chomp.strip.downcase\n $errors << \"Aborted by user\" if answer.size>0 && 'y' == answer[0]\n $warnings = []\n end\n unless $errors.empty?\n STDERR.puts\n STDERR.puts \"Correct the following errors and try again:\"\n STDERR.puts\n $errors.each do |e|\n STDERR.puts \"\\t#{e}\"\n end\n STDERR.puts\n exit(-1)\n end\nend",
"def abort(msg = '')\n\t\toutput.print_error(\"fatal: #{msg}\")\n\tend"
] | [
"0.6760447",
"0.6760447",
"0.6760447",
"0.66977006",
"0.66387033",
"0.66124356",
"0.65121037",
"0.65121037",
"0.6505365",
"0.6505365",
"0.64948213",
"0.64658535",
"0.6462581",
"0.6450131",
"0.64484215",
"0.6443852",
"0.6443852",
"0.62847024",
"0.6256926",
"0.6215372",
"0.6215372",
"0.6215372",
"0.6215372",
"0.6215372",
"0.6215372",
"0.6215372",
"0.6215372",
"0.6184439",
"0.6132245",
"0.60989714",
"0.6088703",
"0.60519505",
"0.6044812",
"0.6016843",
"0.59966207",
"0.59684414",
"0.59684414",
"0.5946397",
"0.5902959",
"0.5829077",
"0.58253205",
"0.58173984",
"0.58071876",
"0.57962894",
"0.5794025",
"0.57921743",
"0.5791987",
"0.5766725",
"0.57538086",
"0.57538086",
"0.57538086",
"0.5744443",
"0.5737407",
"0.57360226",
"0.57360226",
"0.57234734",
"0.5722443",
"0.5721518",
"0.571972",
"0.5675595",
"0.5673741",
"0.5666444",
"0.56541526",
"0.56409574",
"0.5635762",
"0.56315756",
"0.5631486",
"0.5631486",
"0.5631438",
"0.5625673",
"0.56144017",
"0.56144017",
"0.5611147",
"0.55915624",
"0.5588814",
"0.5578713",
"0.5567129",
"0.5565676",
"0.55641586",
"0.5562938",
"0.555998",
"0.5559076",
"0.5552786",
"0.5538195",
"0.5536281",
"0.552305",
"0.5517028",
"0.5516318",
"0.54976016",
"0.5494991",
"0.54916763",
"0.5488894",
"0.54776007",
"0.54767",
"0.5454443",
"0.5452893",
"0.5452488",
"0.54445523",
"0.5444545",
"0.5444545",
"0.54418236"
] | 0.0 | -1 |
A fancier `abort` and `warn`. This will probably really annoy someone at some point because it's overriding a Kernel method, but it's limited to checks. | def abort(message, *extras)
extras << { :color => :red }
warn message, *extras
exit 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abort(message)\n warn message\n exit 1\nend",
"def abort(message)\n warn message\n exit 1\nend",
"def run_warned; end",
"def abortWithUsage( msg = \"Aborted.\" )\n\tmsg = msg + Usage\n\tabortRun( msg )\nend",
"def lwarn; end",
"def warn(*args); end",
"def warn(*args); end",
"def warn\n\n end",
"def abort(msg = '')\n\t\toutput.print_error(\"fatal: #{msg}\")\n\tend",
"def warning(*args); end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def warned; end",
"def abort(msg)\n puts msg\n exit(1)\nend",
"def abort; end",
"def abort; end",
"def abort; end",
"def abort( msg )\n\t$stderr.puts( msg )\n\texit 1\nend",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def warn(*args)\n # eliminate ruby/gem warnings from output\nend",
"def gocdkit_warn(*message)\n unless ENV['GOCDKIT_SILENT']\n warn message\n end\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warn(progname = T.unsafe(nil), &block); end",
"def abort_with_note(message=nil)\n $stderr.puts message if message\n abort \"See `rokko --help' for usage information.\"\nend",
"def abort!(msg)\n @log.error msg\n exit\nend",
"def warn(*args)\n self.warned = true\n super\n end",
"def abort( msg )\n @log.fatal msg\n exit 1\n end",
"def abort ; conclude(false) ; end",
"def abort( msg )\n puts \"\\nAborting!\"\n puts \" #{msg}\"\n puts\n exit 1\n end",
"def warned=(_arg0); end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def abort(*msg)\n option = { :io => $stdout, :kernel => Kernel }\n option.merge! msg.extract_options!\n option[:io].puts \"Error: #{msg.join(' ')}\"\n option[:kernel]::exit(1)\nend",
"def aborting=(_arg0); end",
"def abort( msg )\n @log.fatal msg\n exit 1\n end",
"def abort(msg)\n logger.error msg\n exit 1\n end",
"def warn message\n super message if @verbosity > 1\n end",
"def old_and_busted\n warn \"#old_and_busted is deprecated. Use #new_hotness instead.\"\n puts \"Hello, world\"\nend",
"def abort_on_exception(*) end",
"def octokit_warn(*message)\n unless ENV['OCTOKIT_SILENT']\n warn message\n end\n end",
"def warn(p0) end",
"def warn *args\n @invoked = { name: :warn, args: args }\n end",
"def silence_warnings\n saved_verbosity = $-v\n $-v = nil\n yield\nensure\n $-v = saved_verbosity\nend",
"def abort(*rest) end",
"def abort_if_errors\n unless $warnings.empty?\n STDERR.puts\n STDERR.puts \"The following warnings were generated:\"\n STDERR.puts\n $warnings.each do |w|\n STDERR.puts \"\\tWarning: #{w}\"\n end\n STDERR.puts\n end\n unless $errors.empty?\n STDERR.puts\n STDERR.puts \"Correct the following errors and try again:\"\n STDERR.puts\n $errors.each do |e|\n STDERR.puts \"\\t#{e}\"\n end\n STDERR.puts\n exit(-1)\n end\nend",
"def abort_if_errors\n unless $warnings.empty?\n STDERR.puts\n STDERR.puts \"The following warnings were generated:\"\n STDERR.puts\n $warnings.each do |w|\n STDERR.puts \"\\tWarning: #{w}\"\n end\n STDERR.puts\n end\n unless $errors.empty?\n STDERR.puts\n STDERR.puts \"Correct the following errors and try again:\"\n STDERR.puts\n $errors.each do |e|\n STDERR.puts \"\\t#{e}\"\n end\n STDERR.puts\n exit(-1)\n end\nend",
"def warn(*args, &block)\n method_missing(\"warn\", *args, &block)\n end",
"def abort_if_errors\n unless $warnings.empty?\n STDERR.puts\n STDERR.puts \"The following warnings were generated:\"\n STDERR.puts\n $warnings.each do |w|\n STDERR.puts \"\\tWarning: #{w}\"\n end\n STDERR.print \"\\nAbort program? (y/N) \"\n answer = (gets).chomp.strip.downcase\n $errors << \"Aborted by user\" if answer.size>0 && 'y' == answer[0]\n $warnings = []\n end\n unless $errors.empty?\n STDERR.puts\n STDERR.puts \"Correct the following errors and try again:\"\n STDERR.puts\n $errors.each do |e|\n STDERR.puts \"\\t#{e}\"\n end\n STDERR.puts\n exit(-1)\n end\nend",
"def abort_if_errors\n unless $warnings.empty?\n STDERR.puts\n STDERR.puts \"The following warnings were generated:\"\n STDERR.puts\n $warnings.each do |w|\n STDERR.puts \"\\tWarning: #{w}\"\n end\n STDERR.print \"\\nAbort program? (y/N) \"\n answer = (gets).chomp.strip.downcase\n $errors << \"Aborted by user\" if answer.size>0 && 'y' == answer[0]\n $warnings = []\n end\n unless $errors.empty?\n STDERR.puts\n STDERR.puts \"Correct the following errors and try again:\"\n STDERR.puts\n $errors.each do |e|\n STDERR.puts \"\\t#{e}\"\n end\n STDERR.puts\n exit(-1)\n end\nend",
"def warning(msg) log(4, msg); end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def about_to_abort(options, exception = nil)\n dump_all_information(options)\n # https://code.google.com/p/phusion-passenger/issues/detail?id=1039\n puts\n end",
"def abort(*args)\n puts *args\n exit 1\n end",
"def abort_on_exception=(*) end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def abortRun( msg = \"Aborted.\" )\n\t$stderr.puts msg\n\texit 1\nend",
"def warn_without_prefix( msg = \"\" )\n warn msg\n end",
"def abort!\n throw :abort!, :aborted\n end",
"def silence_warnings(&block)\n with_warnings(nil, &block)\n end",
"def raise_deprecations; end",
"def disabled_warnings; end",
"def fatal; end",
"def warn(fmt, *args)\n end",
"def abort(message)\n UI.puts \"PROGRAM HALT: #{message}\"\n Kernel.abort message\n end",
"def opoo(warning)\n # $stderr.puts \"#{Tty.yellow}Warning#{Tty.reset}: #{warning}\"\n warn \"#{Tty.yellow}Warning#{Tty.reset}: #{warning}\"\n end",
"def abort(s)\n report_error(s)\n exit 1\nend",
"def abort(s)\n report_error(s)\n exit 1\nend",
"def abort(s)\n report_error(s)\n exit 1\nend",
"def warn?; @level <= WARN; end",
"def warn?; @level <= WARN; end",
"def abort_on_exception=(_arg0); end",
"def silence_deprecations=(_arg0); end",
"def err(message)\n warn \" > #{message}\"\nend",
"def warning(fmt, *args)\n end",
"def abort!(message)\n error(message)\n exit 1\n end",
"def die(msg=\"unknown problem occurred\")\n abort [\n \"\",\n \"🐒\",\n \" ⌇\",\n \" 💩 DERP!! Um, whut: #{msg}\",\n \"\",\n \"\",\n ].join(\"\\n\")\n end",
"def silence_warnings\n old_verbose, $VERBOSE = $VERBOSE, nil\n yield\nensure\n $VERBOSE = old_verbose\nend",
"def silence_warnings\n old_verbose, $VERBOSE = $VERBOSE, nil\n yield\nensure\n $VERBOSE = old_verbose\nend",
"def silence_unused_warning(pool)\r\n raise ArgumentError, 'pool is nil' unless pool\r\n end",
"def no_warn\n verbose = $VERBOSE\n $VERBOSE = nil\n yield\n ensure\n $VERBOSE = verbose\n end",
"def silence_warnings\n yield\nend",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def warn(*args)\n `#{@native}.warn.apply(#{@native}, args)`\n end",
"def warn(msg)\n stderr \"warning: #{msg}\"\n end",
"def warn(topic, message = T.unsafe(nil), &block); end",
"def warning(text); end",
"def warning(text); end",
"def warn(_message)\n raise NotImplementedError.new\n end",
"def silence_deprecations; end",
"def supporting_method\n logger.warn 'This does nothing'\n end",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end"
] | [
"0.7133231",
"0.7133231",
"0.65792763",
"0.65417916",
"0.65364456",
"0.6531234",
"0.6531234",
"0.6527851",
"0.64975965",
"0.6474415",
"0.64583933",
"0.6394808",
"0.63805366",
"0.6338931",
"0.6338931",
"0.6338931",
"0.63114274",
"0.63012695",
"0.62852293",
"0.62813866",
"0.6255736",
"0.6255736",
"0.6255736",
"0.6251831",
"0.62301713",
"0.61737716",
"0.61715245",
"0.6164273",
"0.61609834",
"0.6155132",
"0.6152058",
"0.6150375",
"0.6150375",
"0.6150375",
"0.6135926",
"0.6125003",
"0.61176735",
"0.6108915",
"0.6108369",
"0.610572",
"0.60853314",
"0.6084648",
"0.6082475",
"0.60495114",
"0.604531",
"0.60304403",
"0.5992566",
"0.5992566",
"0.59894323",
"0.5975854",
"0.5975854",
"0.5970257",
"0.5962382",
"0.5961374",
"0.59517473",
"0.5951531",
"0.5939897",
"0.5939897",
"0.5939897",
"0.5939897",
"0.5939897",
"0.5939897",
"0.5939897",
"0.5939897",
"0.5911993",
"0.5840969",
"0.5822387",
"0.5808966",
"0.58077914",
"0.5799967",
"0.578726",
"0.5769538",
"0.57673126",
"0.57665586",
"0.57645684",
"0.57645684",
"0.57645684",
"0.5760389",
"0.5760389",
"0.57574266",
"0.5750182",
"0.5748845",
"0.5746586",
"0.5744894",
"0.57350075",
"0.5724281",
"0.5724281",
"0.5716578",
"0.57135725",
"0.57130104",
"0.570826",
"0.56918466",
"0.56832033",
"0.5673364",
"0.56644964",
"0.56644964",
"0.5664446",
"0.56577146",
"0.56552064",
"0.56439036"
] | 0.62405723 | 24 |
Helper method creating a link calling a Javascript function adding a file field for file association | def link_to_new_file(name)
link_to_function name, js_add_new_file(ArticleFile.new)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_iform_link(name, id, obj, locals={})\n link_to_function name do |page|\n page.insert_html :bottom, id, :partial => 'iform', :object => obj, :locals => locals\n end\n end",
"def js_add_new_file(object)\n update_page do |p|\n p.insert_html :bottom, 'files', :partial => 'file', :object => object\n end\n end",
"def new_association_link(name, f, model, additional_javascript = \"\")\n fields = new_child_fields(f, model.to_sym)\n link_to_function(name, raw(\"replace_content(this, \\\"#{model}\\\", \\\"#{escape_javascript(fields)}\\\");$(\\\"#add-#{model}-select-link\\\").show();$(\\\"#add-#{model}-entry-link\\\").hide();#{additional_javascript}\"), :id=> \"add-#{model}-entry-link\", :class=>\"add-child-form-link admin-link\")\n end",
"def attachment_form(model)\n s = \"<div id=\\\"files\\\" class=\\\"files\\\">\\n <ul>\\n \"\n model.attachments.each do |attachment|\n s << \"<li><a href=\\\"#{attachment.public_path}\\\">#{attachment.name}</a> (#{a('delete', rs(:delete_attachment, model.name, attachment.name))})</li>\\n\"\n end\n s << \"</ul>\\n</div>\\n\\n\"\n\n s << <<EOF\n<script type=\"text/javascript\">\n // The number of created attachments.\n var created_attachments = 0;\n // The number of existing attachments.\n var existing_attachments = 0;\n\n function add_attachment_field_to(element) {\n // The attachment id we'll be creating;\n var id = created_attachments++;\n existing_attachments++;\n\n // The paragraph which contains our file entry line.\n var p = document.createElement('p');\n\n // Label.\n var label = document.createElement('label');\n label.setAttribute('for', 'attachments_' + id);\n label.appendChild(document.createTextNode('Attach:'));\n p.appendChild(label);\n\n // File field.\n field = document.createElement('input');\n field.setAttribute('id', 'attachments_' + id);\n field.setAttribute('name', 'attachments[' + id + ']');\n field.setAttribute('size', '30');\n field.setAttribute('type', 'file');\n field.setAttribute('onchange', 'attachment_field_changed(this);');\n p.appendChild(field);\n\n // Remove button\n remove = document.createElement('input');\n remove.setAttribute('type', 'button');\n remove.setAttribute('value', 'Clear');\n remove.setAttribute('onclick', 'clear_attachment_field(this.previousSibling);');\n p.appendChild(remove);\n\n // Add paragraph to element.\n element.appendChild(p);\n }\n\n function attachment_field_changed(field) {\n if (field.value.length == 0) {\n remove_attachment_field(field);\n }\n if (field.value.length > 0) {\n add_attachment_field_to(field.parentNode.parentNode);\n }\n }\n\n function clear_attachment_field(field) {\n field.value = '';\n attachment_field_changed(field);\n }\n\n function remove_attachment_field(field) {\n if (existing_attachments > 1) {\n field.parentNode.parentNode.removeChild(field.parentNode);\n existing_attachments--;\n }\n }\n\n // Add the first attachment field.\n add_attachment_field_to(document.getElementById('files'));\n</script>\nEOF\n end",
"def sitefeedback_filestab_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(\"/media-gallery/\").innerText(\"Files\"), __method__)\n end",
"def add_attachment_link(name, attachment_name, attachment_model_name)\n link_to_function name do |page|\n page.insert_html :bottom, attachment_name.pluralize.to_sym, :partial => attachments_name, :object => Run.attachment_model_name.to_model.new\n end\n end",
"def link_to_add_field(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s + \"_form\", :f => builder)\n end\n link_to_function(name, (\"add_field(this, '#{association}', '#{escape_javascript(fields)}')\"))\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n\t\trender(association.to_s.singularize + \"_fields\", :f => builder)\n\tend\n\t#Rails 3 doesn't need the h method\n #link_to_function(name, h(\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n\tlink_to_function(name, (\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n end",
"def file_link\n return \"#{SITE_URL}system/ufiles/#{id}/original/#{ufile_file_name}\"\n end",
"def add_file(filename)\n step('I visit the new file page')\n fill_in(\"file_label\", with: filename)\n attach_file('file_file', filename)\n fill_in('file_description', with: sample_file_description(filename))\n click_link_or_button('Upload File')\n wait_for_ajax_complete\nend",
"def linkfile\n curfile = File.last_added(\"#{Downloads_path}/*.pdf\")\n unless curfile # no last file found\n growl(\"Sorry, no PDFs found in that directory\")\n exit(0)\n end\n\n f = MacTypes::FileURL.path(curfile)\n Selection[0].linked_files.add(f,{:to =>Selection[0]})\n Selection[0].auto_file\n\n growl(\"PDF added\", \"File added successfully to #{Selection[0].cite_key.get}\")\nend",
"def link_to_add_fields(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder, :obj => nil)\n end\n link_to_function(name, h(\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n end",
"def link_to_add_static_fields name, icon, partial\n # render the partial. We generate a \"new_<partial name>\" id (which gets\n # re-written by client-side JS to a realistic, unique ID when the\n # rendered partial is inserted). We also provide an empty item, which\n # signals to the partial that it should render empty fields rather than\n # pre-filling them with existing values.\n fields = render(:partial => partial + '_fields', :locals => {:id => \"new_#{partial}\", :item => {}})\n\n # add an icon to the link text\n content = (\"<i class='#{icon}'></i> \" + name).html_safe\n\n # Link to the javascript that will insert the partial we rendered\n link_to_function(content, \"TemplateBuilder.add_fields(this, \\\"#{partial}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name, icon, f, association, link_classes = '', create_children=nil)\n # Creates the new object\n new_object = f.object.class.reflect_on_association(association).klass.new\n\n # Create the object's children, if create_children is non-nil\n if create_children\n 4.times{new_object.send(create_children).build}\n end\n\n # Render the partial that will be insterted via javascript when this link is\n # clicked\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(:partial => association.to_s.singularize + \"_fields\", :locals => {:f => builder})\n end\n\n # The link text is an icon and the value of the <name> argument\n content = (\"<i class='#{icon}'></i> \" + name).html_safe\n\n # Link to the javascript that will insert the partial we rendered\n link_to_function(content, \"TemplateBuilder.add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\", :class => link_classes)\n end",
"def add_link(name, form, obj_name)\n field = ''\n form.fields_for obj_name, obj_name.to_s.classify.constantize.new do |f|\n field = render :partial => 'people/' + obj_name.to_s.singularize, :object => f\n end\n link_to_function name, :class => 'add' do |page|\n page << %{\n var new_id = \"new_\" + new Date().getTime();\n $('fieldset_#{obj_name}').insert({ bottom: \"#{ escape_javascript field }\"\\.replace(/new_\\\\d+/g, new_id) });\n }\n end\n end",
"def link_to_add_fields(name,f,association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association,new_object, :child_index=>\"new_#{association}\") do |builder|\n render(association.to_s.pluralize+\"/\"+association.to_s.singularize + \"_fields\", :f => builder)\n end\n ui_link_to_function('add',name,\"add_fields(this,\\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name,f,association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association,new_object, :child_index=>\"new_#{association}\") do |builder|\n render(association.to_s.pluralize+\"/\"+association.to_s.singularize + \"_fields\", :f => builder)\n end\n ui_link_to_function('add',name,\"add_fields(this,\\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object,\n :child_index => \"new_#{association}\") do |builder| \n render(\"form_\" + association.to_s, :f => builder)\n end\n link_to_function(name, h(\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n end",
"def add_widget_child_link(name, f, method)\n fields = new_widget_child_fields(f, method)\n # name = add_no_alt_icon + \" \" + name\n link_to_function(name, h(\"insert_fields(this, \\\"#{method}\\\", \\\"#{escape_javascript(fields)}\\\")\"))\n end",
"def link_to_add_fields(name, f, association, divname, count_range, max_len, add_class)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\", \\\"#{divname}\\\", \\\"#{count_range}\\\")\", :class => \"add_fields \"+ add_class, 'data-max_len'=> max_len )\n\n end",
"def link_to_add_fields(name, f, association, params={})\n\t\tnew_object = f.object.class.reflect_on_association(association).klass.new\n\t\tfields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n\t\t\t#merge the params hash with the form builder being sent as a local variable to the partial\n\t \t\trender(association.to_s.singularize + \"_fields\", {:f => builder}.merge(params))\n\t\tend\n\t\tlink_to_function(name, \"add_fields(this, '#{association}', '#{escape_javascript(fields)}')\")\n\tend",
"def link_to_add_fields(name, f, association, params={})\n\t\tnew_object = f.object.class.reflect_on_association(association).klass.new\n\t\tfields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n\t\t\t#merge the params hash with the form builder being sent as a local variable to the partial\n\t \t\trender(association.to_s.singularize + \"_fields\", {:f => builder}.merge(params))\n\t\tend\n\t\tlink_to_function(name, \"add_fields(this, '#{association}', '#{escape_javascript(fields)}')\")\n\tend",
"def upload_files_to_folder(folder_name)\n if frm.li(:text=>/A/, :class=>\"menuOpen\").exist?\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).li(:text=>/A/, :class=>\"menuOpen\").fire_event(\"onclick\")\n else\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Start Add Menu\").fire_event(\"onfocus\")\n end\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Upload Files\").click\n instantiate_class(:upload_files)\n end",
"def file_field(form_datum, k, file_type)\n file = form_datum.attachments.detect{ |a| a.section_field_id.to_s == k.to_s}\n file_text = file_type == 'expirable_file' ? (file.try(:expiration_date) || '') : ''\n unless file && file.file.url.include?('placeholder.jpg')\n file ? (link_to file_text, file.file.url, download: file, class: 'fa fa-download') : '-'\n # if file_type == \"file\"\n # 'empty file'\n # else\n # file ? (link_to file_text, file.file.url, download: file, class: 'fa fa-download') : '-'\n # end\n else\n 'No Document Attached'\n end\n end",
"def generate_link(failure_file_details, file_path)\n \"<strong><a href='xdoclet/#{failure_file_details[0].gsub(/\\//, \"_\").gsub(/\\.rb/, \".rb.html\")}' target='_blank'>#{file_path}</a></strong><br/>\"\n end",
"def attachment_input(method, options = {})\n delete_attachment_link = \"delete_#{method}_link\"\n preview_id = \"#{method}_preview\"\n attachment_file_field = \"#{method}_file_field\"\n unless (attachment = @object.send(method)).blank? or (not attachment.file?)\n if (attachment.content_type =~ /^image\\/.+/) and (attachment.styles.member?(:thumbnail) or attachment.styles.member?(:edit))\n style = attachment.styles.member?(:thumbnail) ? :thumbnail : :edit\n preview = <<-HTML\n <img id=\"#{preview_id}\" src=\"#{attachment.url(style)}\" />\n HTML\n else\n preview = <<-HTML\n <a href=\"#{attachment.url}\" id=\"#{preview_id}\">#{attachment.original_filename}</a>\n HTML\n end\n end\n deleter_input_id = \"#{method}_deleter\"\n deleter_input_html = hidden_field(method.to_s + '_file_name', :value => '', :id => deleter_input_id )\n magic = <<-JAVASCRIPT\n <script type=\"text/javascript\">\n $(function() {\n $(\"##{delete_attachment_link}\").click(function() {\n $('##{preview_id}').hide();\n $('##{delete_attachment_link}').hide();\n $(this).after('#{deleter_input_html}');\n return false;\n });\n $('form').submit(function () {\n if ($('##{attachment_file_field}').val() != '') {\n $('##{deleter_input_id}').remove();\n }\n return true;\n });\n })\n </script>\n JAVASCRIPT\n ff = file_field method, {:id => attachment_file_field}.merge(options.except(:required))\n if preview\n preview << <<-HTML\n <span class=\"attachment_delete\" id=\"#{delete_attachment_link}\">(<a href=\"#delete\">Delete</a>)</span>\n HTML\n end\n l = label(method, options.delete(:label), options.slice(:required))\n\n template.content_tag(:li, <<-HTML, nil, false)\n #{l}\n #{ff}\n <div class=\"attachment_preview\">#{preview}</div>\n #{magic}\n HTML\n end",
"def link_to_add_fields(name, f, association, partial = nil, options = {})\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render((partial.nil? ? association.to_s.singularize + \"_fields\" : partial), :f => builder)\n end\n link_to_function(name, (\"add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\").html_safe, add_html_classes(options, \"btn btn-success\") )\n end",
"def field_file libelle, prop, value = nil, options = nil\n Field.new(:file, libelle, prop, value, options).form_row\n end",
"def audio_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='audio_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end",
"def link_file(filename, title = T.unsafe(nil), anchor = T.unsafe(nil)); end",
"def link_file(filename, title = T.unsafe(nil), anchor = T.unsafe(nil)); end",
"def link\n file = XFile.first(id: params[:id], uploaded: true)\n\n raise RequestError.new(:file_not_found, \"File not found or not public\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not get the download link of the root folder\") if file.id == session[:user].root_folder.id\n raise RequestError.new(:bad_param, \"Can't get the link of a folder\") if file.folder\n\n file.generate_link\n @result = { link: file.link, uuid: file.uuid, success: true }\n end",
"def link_to_add_fields(name, f, association, parent_container_query)\n new_object = f.object.class.reflect_on_association(association).klass.new\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n link_to_function(name, \"add_fields(\\\"#{parent_container_query}\\\", \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\")\n end",
"def normal_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='normal_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end",
"def create\n\n @link = Link.new(params[:link])\n @link.resource_id = @resource.id\n \n if [email protected]? \"http://\"\n @link.link = \"http://\" + @link.link\n end\n\n\n @resource.attachment = @link\n @resource.save\n\n @link.save\n\n\n\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end",
"def file_input_tag(id: nil)\n <<-HTML.html_safe\n <a class=\"file-upload-button btn-floating btn-large waves-effect waves-light\"><i class=\"material-icons\">add</i></a>\n #{file_field_tag id, class: 'file-input'}\n HTML\n end",
"def link_path\n File.join(\"/f/#{@page_name}\", name) # /foo/bar_files/file.jpg\n end",
"def link_file(href, title)\n \"<file %p %p>\" % [href, title]\n ''\n end",
"def file_field_for(method,options={})\n content = build_tags(method,options)\n content << @template.file_field(@object_name,method,sanitize_opts(options))\n end",
"def add_file(attrs)\n return if search(\"//ovf:References/ovf:File[@ovf:href='#{attrs[:href]}']\").count == 1\n file = Nokogiri::XML::Node.new 'File', self\n file['ovf:href'] = attrs[:href] if attrs[:href]\n if attrs[:id]\n file['ovf:id'] = attrs[:id]\n else\n n = filecount + 1\n file['ovf:id'] = \"file#{n}\"\n end\n at('//ovf:References').add_child file\n end",
"def add_images_link(name)\r\n link_to_function name do |page|\r\n page.insert_html :bottom, :images, :partial => 'image' , :object => Image.new\r\n end\r\n end",
"def neofiles_link(file, tag_content = nil, html_attrs = {})\n html_attrs[:href] = neofiles_file_url file unless html_attrs[:href]\n content_tag(:a, tag_content.presence || file.description.presence || file.filename, html_attrs)\n end",
"def addFile(url, local_name)\r\n\t\t\t`bitsadmin /rawreturn /addfile {#{@id}} #{url} #{local_name}`\r\n\t\tend",
"def add_fields_link(name, f, association)\n if (name == nil or name == \"\" or f == nil or association == nil or association == \"\")\n return false\n end\n \n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n metarows = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-primary\", data: {id: id, metarows: metarows.gsub(\"\\n\", \"\")})\n \n #return true #gets displayed in view\n end",
"def link_path\n File.join('/_attachment', @page_name, name)\n end",
"def link_to_add_fields(name, association, *args)\n options = args.extract_options!\n\n new_object = object.class.reflect_on_association(association).klass.new\n fields = fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n @template.render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n\n options.merge!(:class => \"add_fields btn\", :data => { :association => association, :content => CGI::escapeHTML(fields.gsub(/\\t|\\n|\\r/, \"\")) })\n @template.link_to(name, \"#\", options)\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_partial\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def link_to_add_fields(name, f, type)\n new_object = f.object.send \"build_#{type}\"\n id = \"new_#{type}\"\n fields = f.send(\"#{type}_fields\", new_object, child_index: id) do |builder|\n render(type.to_s + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def link_to_add_association(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n model_name = new_object.class.name.underscore\n hidden_div = content_tag('div', :id => \"#{model_name}_fields_template\", :style => \"display:none;\") do\n render_association(association, f, new_object)\n end\n hidden_div.html_safe + link_to(name, '#', :class => 'add_fields', :'data-association' => association.to_s.singularize)\n end",
"def upload_file\n @assignment = Assignment.find(params[:id])\n if ((@assignment.facebook_user.id == @fb_user.id) or (@assignment.is_author? @fb_user))\n @add_file_url = ActionController::Base.asset_host + \"/assignments/add_file/\"\n else\n flash[:alert] = \"You do not have permissions to add a file to that assignment.\"\n redirect_to @assignment\n end\n\n end",
"def file_field; end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render('shared/' + association.to_s.singularize + '_fields', f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def attach_file(book, field,field_name)\n book.send(field_name).attach(io: open_file(book[field]), filename: field)\n url_for(book[field_name])\n end",
"def link_to_add_ingest_association(f, association)\n group = association.to_s.singularize\n label = I18n.t(\"ingest_form.#{group}.add\", :default => \"Add #{group}\")\n html = %Q|<span class=\"sr-only\">#{label}</span><i class=\"icon-plus icon-white\"></i>|\n return link_to_add_association(raw(html), f, association,\n :class => \"btn btn-success\",\n :title => label,\n :partial => \"ingest/ingest_fields\"\n )\n end",
"def file_custom_fields\n group_custom_fields 'file'\n end",
"def file_custom_fields\n group_custom_fields 'file'\n end",
"def file_field(object_name, method, options = {})\n InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_input_field_tag(\"file\", options)\n end",
"def file_list files\n files.map { |gf| link_to_file(gf) }.join(', ').gsub(/\"/, \"'\")\n end",
"def create_usecase_file\n find_user\n if [email protected]?\n assign_project_use\n if !params[:usecase].empty?\n @usecase1=UseCase.find(:all, :conditions=>[\"name ILIKE ?\", params[:usecase]])\n if [email protected]? and @user.privilige!=\"Read\"\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n flag=UseCase.find_link_use_file(@file, @usecase1[0])\n if flag==false\n UseCase.insert_use_file(@file, @usecase1[0])\n @file_use=@usecase1[0]\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n\n\n end\n respond_to do |format|\n format.js\n end\n end",
"def ui_file_field(name, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Files::FileField.new(name, options, html_options, &block).render\n end",
"def link_to_add_fields(name, f, association, additional_params={})\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n data = {id: id, fields: fields.gsub(\"\\n\", \"\")}\n data[:insertion_point] = additional_params[:insertion_point] unless additional_params[:insertion_point].nil?\n link_to(name, '#', class: \"add_fields \" + (additional_params[:class].nil? ? \"\" : additional_params[:class]), data: data)\n end",
"def custom_file_browser_field(name, title, id,*args)\n args[0] ||= {}\n args.first[:col] ||= \"8\"\n @template.content_tag :div, class: \"mdl-cell--#{args.first[:col]}-col mdl-cell--#{args.first[:col]}-col-tablet ml-color--shades-white m-8\" do\n @template.content_tag :div, class: \"mdl-grid mdl-grid--no-spacing\" do\n div = @template.content_tag :div, class: \"mdl-cell--6-col mdl-cell--6-col-tablet ekitpage\" do\n @template.content_tag :div, class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label disableinput\" do\n # str = file_field(name, id: id, class: \"upload\")\n str = label(title, options[:label])\n end \n end\n div += @template.content_tag :div, class: \"mdl-cell--1-col mdl-cell--1-col-tablet fileUpload thems-imgupload\" do\n str = file_field(name, id: id[:id], class: \"upload\")\n end\n div += @template.content_tag :div, class: \"mdl-cell--5-col mdl-cell--5-col-tablet\" do\n @template.label(\"\", \"\", class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label file_name\", id: \"1#{id[:id]}\" )\n end\n end\n end \n end",
"def custom_file_browser_field(name, title, id,*args)\n args[0] ||= {}\n args.first[:col] ||= \"8\"\n @template.content_tag :div, class: \"mdl-cell--#{args.first[:col]}-col mdl-cell--#{args.first[:col]}-col-tablet ml-color--shades-white m-8\" do\n @template.content_tag :div, class: \"mdl-grid mdl-grid--no-spacing\" do\n div = @template.content_tag :div, class: \"mdl-cell--6-col mdl-cell--6-col-tablet ekitpage\" do\n @template.content_tag :div, class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label disableinput\" do\n # str = file_field(name, id: id, class: \"upload\")\n str = label(title, options[:label])\n end \n end\n div += @template.content_tag :div, class: \"mdl-cell--1-col mdl-cell--1-col-tablet fileUpload thems-imgupload\" do\n str = file_field(name, id: id[:id], class: \"upload\")\n end\n div += @template.content_tag :div, class: \"mdl-cell--5-col mdl-cell--5-col-tablet\" do\n @template.label(\"\", \"\", class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label file_name\", id: \"1#{id[:id]}\" )\n end\n end\n end \n end",
"def select_file(file_name, file_path=\"\")\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(file_path + file_name)\n @@file_number += 1\n end",
"def link_to_add_fields(name, f, association, fields_partial, modal, options = {})\n sel2NoMatch = t(\"select2.no_matches\")\n new_object = f.object.class.reflect_on_association(association).klass.new\n #fields = f.fields_for(association, new_object, :child_index => \"new_#{ association }\", :onsubmit => \"return $(this.)validate();\") do |builder|\n #fields = f.fields_for(association, new_object, :child_index => \"new_#{ fields_partial }\", :onsubmit => \"return $(this.)validate();\") do |builder|\n fields = f.simple_fields_for(association, new_object, :child_index => \"new_#{ fields_partial }\", :onsubmit => \"return $(this.)validate();\") do |builder|\n render(fields_partial, :f => builder)\n #render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n #link_to_function(name, \"add_fields(this, \\\"#{ association }\\\", \\\"#{ escape_javascript(fields) }\\\")\", options)\n link_to_function(name, \"add_fields(this, \\\"#{ fields_partial }\\\", \\\"#{ modal }\\\", \\\"#{ escape_javascript(fields) }\\\", \\\"#{ sel2NoMatch }\\\")\", options)\n end",
"def insert_link (fileArray, linkName, utilHash)\n\nend",
"def render_document_link args\n fulltext_path = args[:document][args[:field]] unless args[:document][args[:field]].blank?\n if fulltext_path.present?\n # This all hinges on symbolic link in public directory (to /teeal/documents)\n path = \"/downloads/#{fulltext_path}\"\n link_to path, target: \"_blank\", class: \"btn btn-sm btn-success\" do\n '<i class=\"fa fa-file-text\"></i> View full text'.html_safe\n end\n end\n end",
"def render_create_content_link(element, options = {})\n\t\t\t\tdefaults = {\n\t\t\t\t\t:label => t('add new content')\n\t\t\t\t}\n\t\t\t\toptions = defaults.merge(options)\n\t\t\t\tlink_to(\n\t\t\t\t\toptions[:label],\n\t\t\t\t\talchemy.admin_contents_path(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t\t:name => options[:content_name],\n\t\t\t\t\t\t\t:element_id => element.id\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t:method => 'post',\n\t\t\t\t\t:remote => true,\n\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t:class => 'button new_content_link'\n\t\t\t\t)\n\t\t\tend",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: { id: id, fields: fields.gsub(\"\\n\", \"\") })\n end",
"def link_to_add_associations(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def get_file\n rid = params[:rid]\n type = params[:type]\n aoid = params[:aoid] || ''\n ref_id = params[:ref_id] || ''\n resource = params[:resource]\n position = params[:position] || '1'\n return render_aspace_partial :partial => \"resources/bulk_file_form\", :locals => {:rid => rid, :aoid => aoid, :type => type, :ref_id => ref_id, :resource => resource, :position => position} \n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-success btn-block\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def file_answer(file_name)\n frm.file_field(:name=>/deliverFileUpload/).set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n frm.button(:value=>\"Upload\").click\n end",
"def link_to_add_fields(name=nil, ff=nil, association=nil, options=nil,\n html_options=nil, attributes={}, &block)\n # If a block is provided there is no name attribute and the arguments are\n # shifted with one position to the left. This re-assigns those values.\n f, association, options, html_options = name, ff, association, options if block_given?\n\n options ||= {}\n html_options ||= {}\n\n locals = options[:locals] || {}\n partial = options[:partial] || association.to_s.singularize + '_fields'\n\n # Render the form fields from a file with the association name provided\n new_object = ff.object.class.reflect_on_association(association).klass.new(attributes)\n fields = ff.fields_for(association, new_object, child_index: 'new_record') do |builder|\n render(partial, locals.merge!( ff: builder))\n end\n\n # The rendered fields are sent with the link within the data-form-prepend attr\n html_options['data-form-prepend'] = raw CGI::escapeHTML( fields )\n html_options['href'] = '#'\n\n content_tag(:a, name, html_options, &block)\n end",
"def button_to_reference_window(url, javascript, options ={})\n link_to_function 'pickup', javascript, options\n end",
"def dropbox_create_shared_link(file)\n url = \"https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings\"\n payload = { path: file, settings: { requested_visibility: \"public\" } }\n\n dropbox_post_json(url, payload: payload) do |json|\n json[\"url\"]\n end\n end",
"def link_for(path)\n [path, { file_name: File.basename(path) }]\n end",
"def file_url(attachment_name, style=nil); file_path(attachment_name, style); end",
"def obfuscated_link_to(path, image, label, args={})\n _html = %{<form action=\"#{path}\" method=\"get\" class=\"obfuscated_link\">}\n _html << %{ <fieldset><input alt=\"#{label}\" src=\"#{image}\" type=\"image\" /></fieldset>}\n args.each{ |k,v| _html << %{ <div><input id=\"#{k.to_s}\" name=\"#{k}\" type=\"hidden\" value=\"#{v}\" /></div>} }\n _html << %{</form>}\n _html\n end",
"def select_file=(file_name)\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n @@file_number += 1\n end",
"def show_file\n options = { type: @static_page.custom_file.file.content_type,\n disposition: 'inline' }\n send_file @static_page.custom_file.path, options\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js\n end\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js\n end\n end",
"def generate_file_data(format, cgi, item_entry, item, download_allowed)\n file_data = \"\"\n file_metadata = generate_item_metadata(format, cgi, item_entry)\n \n case format.downcase\n when \"html\"\n file_data += cgi.li(\"class\" => \"file\"){ \n cgi.div(\"class\" => \"file_item\") do\n cgi.div(\"class\" => \"item_data\") do\n \"<b>File: </b>\" + cgi.a(location_string(item_entry.contributable_type, item.id)){item.title} + \n (download_allowed ? (\" [ \" + cgi.a(\"./files/\" + item.local_name){\"open local copy\"} + \" ]\") : \"\") + \"<br/>\" +\n uploader_string(item.contributor_type, item.contributor_id, true) + \"<br/>\"\n end +\n file_metadata\n end\n }\n \n when \"text\"\n file_data += \"+ File: #{item.title}\"\n if download_allowed\n file_data += \" (local copy: files/#{item.local_name})\"\n end\n file_data += \"\\n Location: \" + location_string(item_entry.contributable_type, item.id)\n file_data += \"\\n \" + uploader_string(item.contributor_type, item.contributor_id, false) + \"\\n\"\n file_data += file_metadata\n \n else\n return \"ERROR\"\n end\n \n return file_data\n end",
"def click_open_file_dialog_popup(title)\n click_button_popup(title, \"&Open\")\nend",
"def image_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<img src='#{object.send(field).url}' class='image_file_field_thumbnail' alt='#'/>\"\n end\n html\n end",
"def file_url\n end",
"def add_datafile\n @data_set = DataSet.find_by(:id=>params[:id])\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def process_file_link_tag(tag)\n parts = tag.split('|')\n return if parts.size.zero?\n\n name = parts[0].strip\n path = parts[1] && parts[1].strip\n path = if path && file = find_file(path)\n ::File.join @wiki.base_path, file.path\n elsif path =~ %r{^https?://}\n path\n else\n nil\n end\n\n if name && path && file\n %{<a href=\"#{::File.join @wiki.base_path, file.path}\">#{name}</a>}\n elsif name && path\n %{<a href=\"#{path}\">#{name}</a>}\n else\n nil\n end\n end",
"def create_requirement_file\n find_user\n if [email protected]?\n if !params[:requirement].empty?\n @requirement1=Requirement.find(:all, :conditions=>[\"name LIKE ?\", params[:requirement]])\n\n if [email protected]? and @user.privilige!=\"Read\"\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n flag=Requirement.find_link_req_file(@file, @requirement1[0])\n if flag==false\n Requirement.insert_req_file(@file, @requirement1[0])\n @file_req=@requirement1[0]\n end\n end\n end\n\n end\n assign_project\n @attr=Attribute.find_by_project_id(session[:project_id])\n end\n respond_to do |format|\n format.js\n end\n\n end",
"def complete_upload_document\n @dom_id = \"##{params[:file][:dom_id]}\"\n\n @asset = Document.new(uploaded_asset_attributes.reverse_merge(uploaded_by: current_user))\n key = @asset.add_meta(params[:file])\n if @asset.save\n @asset.update_columns(media: key)\n end\n render template: \"/dash/chooser/complete_upload\"\n end",
"def fillFileUpload\n fileUploadField = @@browser.file_field(id: 'input_9')\n fileUploadField.exists?\n fileUploadField.set('C:\\upload\\Issues.pdf')\n end",
"def collection_pdf_url(id, label=\"Link\")\n unless id.nil? \n filename = \"#{id.downcase}.pdf\"\n return link_to label, \"/files/#{filename}\"\n end\n end",
"def collection_pdf_url(id, label=\"Link\")\n unless id.nil? \n filename = \"#{id.downcase}.pdf\"\n return link_to label, \"/files/#{filename}\"\n end\n end",
"def gen_rel_path(file)\n file = \"/secure/news/#{@folder}/#{file}\"\n end",
"def url_for_file_column(object_name, method, suffix=nil, object = nil)\n object = instance_variable_get(\"@#{object_name.to_s}\") if object.nil?\n relative_path = object.send(\"#{method}_relative_path\", suffix)\n return nil unless relative_path\n url = \"\"\n url << ActionController::Base.relative_url_root.to_s << \"/\"\n url << object.send(\"#{method}_options\")[:base_url] << \"/\"\n url << relative_path\n end",
"def file_field_tag_v2(title, name, options = {})\n\t\t<<-html\n\t\t\t<div class=\"input-field file-field\">\n\t\t\t\t<div class=\"btn\">\n\t\t\t\t\t<span>#{title}</span>\n\t\t\t\t\t#{if options[:form_builder] then options[:form_builder].file_field(name) else file_field_tag(name) end}\n\t\t\t\t</div>\n\t\t\t\t<div class=\"file-path-wrapper\">\n\t\t\t\t\t<input class=\"file-path\" type=\"text\" readonly>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\thtml\n\t\t.html_safe\n\tend",
"def upload_document\n render template: \"/dash/chooser/upload_document\"\n end"
] | [
"0.6931073",
"0.6861027",
"0.6761558",
"0.6435387",
"0.6432908",
"0.6403012",
"0.63479257",
"0.6327371",
"0.6269697",
"0.62553555",
"0.62317175",
"0.6195633",
"0.6183239",
"0.6180162",
"0.6180162",
"0.6162712",
"0.6154648",
"0.6151103",
"0.6151103",
"0.61375785",
"0.60609525",
"0.6033935",
"0.59766227",
"0.59766227",
"0.5968045",
"0.5878491",
"0.58760977",
"0.5873809",
"0.5869347",
"0.58586",
"0.58563536",
"0.58554196",
"0.58546084",
"0.58404624",
"0.58227324",
"0.5814867",
"0.5808493",
"0.58080065",
"0.5807281",
"0.5792059",
"0.5780495",
"0.57784986",
"0.5773996",
"0.57636344",
"0.57327414",
"0.5731776",
"0.57056445",
"0.56954545",
"0.56849545",
"0.5664286",
"0.56221914",
"0.56164634",
"0.56073046",
"0.5605048",
"0.5602627",
"0.55902237",
"0.55897444",
"0.55897444",
"0.5586664",
"0.558575",
"0.55764467",
"0.55633456",
"0.5561444",
"0.55581045",
"0.55581045",
"0.55551654",
"0.5548459",
"0.55431414",
"0.551328",
"0.5512991",
"0.5503586",
"0.54996645",
"0.549924",
"0.54946196",
"0.54939103",
"0.54863006",
"0.5475191",
"0.54747814",
"0.5464412",
"0.5462941",
"0.54426455",
"0.5431329",
"0.54290164",
"0.54239506",
"0.54239506",
"0.53993917",
"0.53943527",
"0.5389878",
"0.5381642",
"0.5372748",
"0.53491044",
"0.5348363",
"0.5344135",
"0.53408337",
"0.5337223",
"0.5337223",
"0.53359514",
"0.53329414",
"0.5332324",
"0.5330738"
] | 0.77595353 | 0 |
Helper method inserting the famous file field for file association | def js_add_new_file(object)
update_page do |p|
p.insert_html :bottom, 'files', :partial => 'file', :object => object
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_field; end",
"def file_custom_fields\n group_custom_fields 'file'\n end",
"def file_custom_fields\n group_custom_fields 'file'\n end",
"def set_the_field_values\n fn = self.file_name\n unless self.file_ext && !self.file_ext.blank?\n self.file_ext = fn.split('.').last\n end\n ex = self.file_ext\n nm = self.name\n \n pic_name = fn.split('.')\n pic_name.delete(pic_name.last)\n \n pn = pic_name.join('_').to_s.to_go\n \n the_name = ( nm.blank? || nm.start_with?('dcfile_') ) ? pn.titleize : nm.to_s\n the_fname = !nm.blank? ? nm.to_s.to_go : pn\n \n self.name = the_name\n self.original_name = fn\n # => self.file_name = \"#{the_fname}.#{ex}\"\n self.file_name = \"#{ generate_dc_name }.#{ex}\"\n self.image = IMAGE_EXTS.include?( ex.to_s.downcase ) ? true : false\n self.save\n end",
"def normal_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='normal_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end",
"def attach(file)\n existing_file = self.file\n\n file.owner = self\n file.display_filename = existing_file.display_filename if existing_file\n if file.save and existing_file then\n existing_file.owner_type = nil\n existing_file.owner_id = nil\n existing_file.save\n end\n end",
"def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend",
"def save_file_entry\n @user.search_files.create!(file_path: uploaded_file_path.result, file_name: @file.original_filename, status: 'initialized')\n end",
"def field_file libelle, prop, value = nil, options = nil\n Field.new(:file, libelle, prop, value, options).form_row\n end",
"def add_file(attrs)\n return if search(\"//ovf:References/ovf:File[@ovf:href='#{attrs[:href]}']\").count == 1\n file = Nokogiri::XML::Node.new 'File', self\n file['ovf:href'] = attrs[:href] if attrs[:href]\n if attrs[:id]\n file['ovf:id'] = attrs[:id]\n else\n n = filecount + 1\n file['ovf:id'] = \"file#{n}\"\n end\n at('//ovf:References').add_child file\n end",
"def characterize(save: true)\n new_file = original_file.new(file_characterization_attributes.to_h)\n @file_node.file_metadata = @file_node.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n @persister.save(resource: @file_node) if save\n @file_node\n end",
"def audio_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='audio_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end",
"def file_form_field\n @attributes[:file_form_field]\n end",
"def add_file(fname, fdata=nil, xtra=nil, comment=nil)\n super(randomize(fname), randomize(fdata), xtra, comment)\n end",
"def insert_link (fileArray, linkName, utilHash)\n\nend",
"def file_field_tag(name, options = {}) \n html = content_tag(:dt) do\n content_tag(:label , \"#{options.delete(:label)}:\", :for => options[:id])\n end\n \n options[:class] = append_class_name(options[:class], 'file')\n html << content_tag(:dd) do\n @super.file_field_tag(name, options)\n end\n end",
"def file_field_tag_v2(title, name, options = {})\n\t\t<<-html\n\t\t\t<div class=\"input-field file-field\">\n\t\t\t\t<div class=\"btn\">\n\t\t\t\t\t<span>#{title}</span>\n\t\t\t\t\t#{if options[:form_builder] then options[:form_builder].file_field(name) else file_field_tag(name) end}\n\t\t\t\t</div>\n\t\t\t\t<div class=\"file-path-wrapper\">\n\t\t\t\t\t<input class=\"file-path\" type=\"text\" readonly>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\thtml\n\t\t.html_safe\n\tend",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def attach_files\n @parent = Work.find_by_friendlier_id!(params[:parent_id])\n authorize! :update, @parent\n\n current_position = @parent.members.maximum(:position) || 0\n\n files_params = (params[:cached_files] || []).\n collect { |s| JSON.parse(s) }.\n sort_by { |h| h && h.dig(\"metadata\", \"filename\")}\n\n files_params.each do |file_data|\n asset = Asset.new()\n\n if derivative_storage_type = params.dig(:storage_type_for, file_data[\"id\"])\n asset.derivative_storage_type = derivative_storage_type\n end\n\n asset.position = (current_position += 1)\n asset.parent_id = @parent.id\n asset.file = file_data\n asset.title = (asset.file&.original_filename || \"Untitled\")\n asset.published = @parent.published\n asset.save!\n end\n\n if @parent.representative_id == nil\n @parent.update(representative: @parent.members.order(:position).first)\n end\n\n redirect_to admin_work_path(@parent.friendlier_id, anchor: \"nav-members\")\n end",
"def file_field(form_datum, k, file_type)\n file = form_datum.attachments.detect{ |a| a.section_field_id.to_s == k.to_s}\n file_text = file_type == 'expirable_file' ? (file.try(:expiration_date) || '') : ''\n unless file && file.file.url.include?('placeholder.jpg')\n file ? (link_to file_text, file.file.url, download: file, class: 'fa fa-download') : '-'\n # if file_type == \"file\"\n # 'empty file'\n # else\n # file ? (link_to file_text, file.file.url, download: file, class: 'fa fa-download') : '-'\n # end\n else\n 'No Document Attached'\n end\n end",
"def file_field_tag(name, options = T.unsafe(nil)); end",
"def add_file(file)\n @files[file.name] = file\n file.parent = self\n end",
"def image_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<img src='#{object.send(field).url}' class='image_file_field_thumbnail' alt='#'/>\"\n end\n html\n end",
"def attaches_file(id_or_name_or_label, path)\n field = find_field(id_or_name_or_label, FileField)\n field.set(path)\n end",
"def attach_files(files)\n files = [files] unless(files.is_a?(Array))\n files.each do |file|\n file.to_options!\n filename = file[:url]\n assit(filename)\n options = file[:options] || {}\n # BEGIN BY RIK\n talia_file = TaliaFile.new\n talia_file.assign_random_id\n talia_file[N::RDFS.label] << File.basename(filename)\n records = TaliaCore::DataTypes::FileRecord.create_from_url(filename, options)\n records.each do |rec|\n talia_file.data_records << rec\n end\n talia_file[N::TALIA.isFileOf] = self\n self[N::TALIA.hasFile] << talia_file\n # talia_file.save!\n # END BY RIK\n end\n end",
"def add_uploaded_file(shf_app)\n shf_app.uploaded_files << create(:uploaded_file, actual_file: File.open(UPLOAD_PNG_FILE))\n end",
"def add_file(file, dsid, file_name) \n return add_external_file(file, file_name) if dsid == 'content'\n super\n end",
"def upload_file=(file_name)\n self.file_field(:id=>\"multifile_upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-oae/\" + file_name)\n end",
"def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n target_file = @file_set.try(type)\n next unless target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: target_file.file_identifiers[0])\n new_file = target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end",
"def complete_upload_document\n @dom_id = \"##{params[:file][:dom_id]}\"\n\n @asset = Document.new(uploaded_asset_attributes.reverse_merge(uploaded_by: current_user))\n key = @asset.add_meta(params[:file])\n if @asset.save\n @asset.update_columns(media: key)\n end\n render template: \"/dash/chooser/complete_upload\"\n end",
"def feature_upload(id, file)\r\n dir = \"home_features\"\r\n file.original_filename = id.to_s + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end",
"def custom_file_browser_field(name, title, id,*args)\n args[0] ||= {}\n args.first[:col] ||= \"8\"\n @template.content_tag :div, class: \"mdl-cell--#{args.first[:col]}-col mdl-cell--#{args.first[:col]}-col-tablet ml-color--shades-white m-8\" do\n @template.content_tag :div, class: \"mdl-grid mdl-grid--no-spacing\" do\n div = @template.content_tag :div, class: \"mdl-cell--6-col mdl-cell--6-col-tablet ekitpage\" do\n @template.content_tag :div, class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label disableinput\" do\n # str = file_field(name, id: id, class: \"upload\")\n str = label(title, options[:label])\n end \n end\n div += @template.content_tag :div, class: \"mdl-cell--1-col mdl-cell--1-col-tablet fileUpload thems-imgupload\" do\n str = file_field(name, id: id[:id], class: \"upload\")\n end\n div += @template.content_tag :div, class: \"mdl-cell--5-col mdl-cell--5-col-tablet\" do\n @template.label(\"\", \"\", class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label file_name\", id: \"1#{id[:id]}\" )\n end\n end\n end \n end",
"def custom_file_browser_field(name, title, id,*args)\n args[0] ||= {}\n args.first[:col] ||= \"8\"\n @template.content_tag :div, class: \"mdl-cell--#{args.first[:col]}-col mdl-cell--#{args.first[:col]}-col-tablet ml-color--shades-white m-8\" do\n @template.content_tag :div, class: \"mdl-grid mdl-grid--no-spacing\" do\n div = @template.content_tag :div, class: \"mdl-cell--6-col mdl-cell--6-col-tablet ekitpage\" do\n @template.content_tag :div, class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label disableinput\" do\n # str = file_field(name, id: id, class: \"upload\")\n str = label(title, options[:label])\n end \n end\n div += @template.content_tag :div, class: \"mdl-cell--1-col mdl-cell--1-col-tablet fileUpload thems-imgupload\" do\n str = file_field(name, id: id[:id], class: \"upload\")\n end\n div += @template.content_tag :div, class: \"mdl-cell--5-col mdl-cell--5-col-tablet\" do\n @template.label(\"\", \"\", class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label file_name\", id: \"1#{id[:id]}\" )\n end\n end\n end \n end",
"def add_file_to_database(name, path, size, owner)\n $db.execute(\"INSERT INTO files (owner_id, file_name, file_size, file_path, publicity) VALUES (?, ?, ?, ?, 0)\", [owner, name, size, path])\nend",
"def select_file(file_name, file_path=\"\")\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(file_path + file_name)\n @@file_number += 1\n end",
"def link_to_add_association(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n model_name = new_object.class.name.underscore\n hidden_div = content_tag('div', :id => \"#{model_name}_fields_template\", :style => \"display:none;\") do\n render_association(association, f, new_object)\n end\n hidden_div.html_safe + link_to(name, '#', :class => 'add_fields', :'data-association' => association.to_s.singularize)\n end",
"def add_file(file, dsid, file_name) \n return add_external_file(file, dsid, file_name) if dsid == 'content'\n super\n end",
"def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n target_file = @file_set.try(type)\n next unless target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: target_file.file_identifiers[0])\n next unless image_valid?\n new_file = target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = @file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end",
"def file_uploads; end",
"def file_field_for(method,options={})\n content = build_tags(method,options)\n content << @template.file_field(@object_name,method,sanitize_opts(options))\n end",
"def new_files; end",
"def hook_add_files\n @flavor.class.after_add_files do |files, resource_action, type|\n files.each do |file|\n actions_taken << \"#{resource_action} #{type} #{file}\"\n end\n end\n end",
"def link_to_add_associations(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def add entity, name, filename = nil\n entity.set_disposition('form-data', 'name' => name, 'filename' => filename)\n super(entity)\n end",
"def initialize_study_file_associations\n self.original_file_list.each do |file_entry|\n filename = file_entry['name']\n file_type = file_entry['file_type']\n species_name = file_entry['species']\n assembly_name = file_entry['assembly']\n study_file = StudyFile.find_by(file_type: file_type, upload_file_name: filename, study_id: self.study_id)\n if study_file.present?\n study_file.update(study_file_bundle_id: self.id)\n else\n study_file = self.study.study_files.build(file_type: file_type, upload_file_name: filename, study_file_bundle_id: self.id, name: filename)\n if StudyFile::TAXON_REQUIRED_TYPES.include?(file_type) && Taxon.present?\n study_file.taxon_id = Taxon.first.id # temporarily set arbitrary taxon association\n if species_name.present?\n taxon = Taxon.where(common_name: /#{species_name}/i).first\n taxon.present? ? study_file.taxon_id : nil # set requested taxon if we find it\n end\n end\n if StudyFile::ASSEMBLY_REQUIRED_TYPES.include?(file_type) && GenomeAssembly.present?\n study_file.genome_assembly_id = GenomeAssembly.first.id # temporarily set arbitrary assembly association\n if species_name.present?\n assembly = GenomeAssembly.where(name: /#{assembly_name}/i).first\n assembly.present? ? study_file.genome_assembly_id : nil # set requested assembly if we find it\n end\n end\n study_file.save!\n end\n end\n end",
"def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"def filename\n if original_filename.present? && model.photoable.present?\n \"#{model.photoable.display_name.parameterize}-#{secure_token}.#{file.extension}\"\n elsif original_filename.present? && model.photoable.blank?\n \"mydiscoveries-#{secure_token}.#{file.extension}\"\n end\n end",
"def attach_file(book, field,field_name)\n book.send(field_name).attach(io: open_file(book[field]), filename: field)\n url_for(book[field_name])\n end",
"def uploaded_file=(field)\n if field != \"\"\n mt = field.content_type || \"application/binary\"\n self.filename = base_part_of(field.original_filename) \n self.mime_type = mt\n path = get_path\n data = field.read\n self.size = data.length\n if ! File::exist? path\n Dir::mkdir(path)\n else \n # delete old images\n Dir::new(path).each do |oldfile|\n if oldfile[0].chr != '.'\n File::unlink(path+\"/\"+oldfile)\n end\n end\n end\n f = File.new(path + \"/\" + self.filename,\"w\")\n f << data\n f.close\n end\n end",
"def file_field(name = \"\", size = 20, maxlength = nil)\n attributes = if name.kind_of?(String)\n { \"TYPE\" => \"file\", \"NAME\" => name,\n \"SIZE\" => size.to_s }\n else\n name[\"TYPE\"] = \"file\"\n name\n end\n attributes[\"MAXLENGTH\"] = maxlength.to_s if maxlength\n input(attributes)\n end",
"def uploaded_photo=(field)\n self.photo = FileDocument.new if self.photo.nil?\n self.photo.uploaded_file = field\n end",
"def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end",
"def select_file=(file_name)\n frm.file_field(:id=>\"clonableUpload\", :name=>\"upload#{@@file_number}\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-cle-test-api/\" + file_name)\n @@file_number += 1\n end",
"def link_to_add_fields(name, f, association, additional_params={})\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n data = {id: id, fields: fields.gsub(\"\\n\", \"\")}\n data[:insertion_point] = additional_params[:insertion_point] unless additional_params[:insertion_point].nil?\n link_to(name, '#', class: \"add_fields \" + (additional_params[:class].nil? ? \"\" : additional_params[:class]), data: data)\n end",
"def file_set_append\n # Append the array of file metadata values to any FileSets with new FileNodes being appended\n parent.file_metadata += file_nodes\n file_nodes\n end",
"def file_field(object_name, method, options = T.unsafe(nil)); end",
"def file_desc\n \"Files (#{file_ext(',')})\"\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render('shared/' + association.to_s.singularize + '_fields', f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def add_file(filename)\n step('I visit the new file page')\n fill_in(\"file_label\", with: filename)\n attach_file('file_file', filename)\n fill_in('file_description', with: sample_file_description(filename))\n click_link_or_button('Upload File')\n wait_for_ajax_complete\nend",
"def attach_file(field_locator, path, content_type = nil)\n locate_field(field_locator, FileField).set(path, content_type)\n end",
"def add_arquivo_entrega(entrega_id, arquivo)\n \n end",
"def update_file(settings)\n file_path = self.full_path(settings)\n TagLib::MPEG::File.open(file_path) do |file|\n file.tag.artist = self.artist.name\n file.tag.album = self.album.name\n file.tag.year = self.album.year ? self.album.year : 0\n file.tag.genre = self.genre\n file.tag.title = self.name\n file.save\n end\n end",
"def addMetadata(filename, metadatatype, metadatavalue)\n begin\n \n if @fileMetadata.has_key?(filename)\n @fileMetadata[filename] = @fileMetadata[filename].to_s + \"&&&\" + metadatatype.downcase + \":\" + metadatavalue.downcase\n else\n @fileMetadata[filename] = metadatatype.downcase + \":\" + metadatavalue.downcase\n end\n \n rescue Exception => e\n puts \"Error: #{e.to_s}\"\n puts \" -- line: #{e.backtrace[0].to_s}\"\n raise Exception.new(\"Could not add metadata to a new file!\")\n end\n end",
"def file_field(method, options = T.unsafe(nil)); end",
"def link_to_add_fields(name, icon, f, association, link_classes = '', create_children=nil)\n # Creates the new object\n new_object = f.object.class.reflect_on_association(association).klass.new\n\n # Create the object's children, if create_children is non-nil\n if create_children\n 4.times{new_object.send(create_children).build}\n end\n\n # Render the partial that will be insterted via javascript when this link is\n # clicked\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(:partial => association.to_s.singularize + \"_fields\", :locals => {:f => builder})\n end\n\n # The link text is an icon and the value of the <name> argument\n content = (\"<i class='#{icon}'></i> \" + name).html_safe\n\n # Link to the javascript that will insert the partial we rendered\n link_to_function(content, \"TemplateBuilder.add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\", :class => link_classes)\n end",
"def create_file(uid, info = {})\n content_type = Tus::Info.new(info).metadata[\"content_type\"]\n\n create_grid_file(\n filename: uid,\n content_type: content_type,\n )\n end",
"def upload_an_odm(file_path)\n if File.exist?(\"#{file_path}\")\n self.odm_file_input.attach_file(file_path) # theoretically it should work but have not tested out yet.\n else\n raise 'File not found or file does not exist'\n end\n end",
"def replace_with_file(blob, attributes = {})\n File.binwrite(self.file_path, blob)\n\n pdf = CombinePDF.parse blob\n self.update(num_pages: pdf.pages.length, filename: attributes[:new_filename])\n self.save_cover\n end",
"def create_image(title, description, parent_id, mime_type, file_name)\n\t insert_file(title, description, parent_id, 'application/vnd.google-apps.photo', file_name)\n\tend",
"def add_extra_files(*files); end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_partial\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: {id: id, fields: fields.gsub(\"\\n\", \"\")})\n end",
"def external_file_attributes; end",
"def uploaded_narrative=(narrative_field)\n # Nothing yet\n name=narrative_field.original_filename\n file=narrative_field\n if narrative_field!=\"\"\n self.content_type=narrative_field.content_type.chomp\n self.content=narrative_field.read\n if content.starts_with?(\"MSH|\") or content.starts_with?(\"FHS|\")\n raise WedgieError,\"This interface should not be used to upload HL7 -- use Upload File on the left-hand menu instead\"\n end\n convert_docs(name)\n else\n self.content_type=\"text/x-clinical\"\n end \n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def set_FileID(value)\n set_input(\"FileID\", value)\n end",
"def before_saving\n self.save_to_gallery(self.file, self.filename, self.photo_gallery_id, self.user_id)\n# self.save\n# end\n end",
"def link_to_add_fields(name, f, association)\n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n fields = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields\", data: { id: id, fields: fields.gsub(\"\\n\", \"\") })\n end",
"def create_photo(album_id, photo_id, file, filename)\n \n end",
"def file_entry(ref, identifier)\n out = ref[\"attachment\"] ? ref[\"fileref\"] : File.basename(ref[\"fileref\"])\n ret = if ref[\"fileref\"]\n { type: \"fileref\", ref: @documents[identifier].file,\n rel_path: ref[\"fileref\"], out_path: out }\n else { type: \"id\", ref: ref[\"id\"] } end\n %w(attachment sectionsplit index presentation-xml\n bare-after-first).each do |s|\n ret[s.gsub(\"-\", \"\").to_sym] = ref[s] if ref[s]\n end\n ret.compact\n end",
"def file_fields\n @file_fields ||= []\nend",
"def addFile path, username, groupname, rights = 0640\n userRights = getUserRights rights\n groupRights = getGroupRights rights\n othersRights = getOthersRights rights\n file = Modeles::File.new(:path => username + '/' +\n groupname + '/' +\n path,\n :userRights => userRights,\n :groupRights => groupRights,\n :othersRights => othersRights)\n user = Modeles::User.find_by_name username\n return nil if user.nil?\n group = Modeles::Group.find_by_name groupname\n return nil if group.nil?\n file.user = user\n file.group = group\n ret = file.save\n if ret\n FileInfos.new file\n end\n end",
"def update_info(uid, info)\n files_collection.update_one({filename: uid}, {\"$set\" => {metadata: info}})\n end",
"def new_association_link(name, f, model, additional_javascript = \"\")\n fields = new_child_fields(f, model.to_sym)\n link_to_function(name, raw(\"replace_content(this, \\\"#{model}\\\", \\\"#{escape_javascript(fields)}\\\");$(\\\"#add-#{model}-select-link\\\").show();$(\\\"#add-#{model}-entry-link\\\").hide();#{additional_javascript}\"), :id=> \"add-#{model}-entry-link\", :class=>\"add-child-form-link admin-link\")\n end",
"def create\n @persona = Persona.new(params[:persona])\n @persona.user_id = current_user.id\n @persona.avatar = params[:file]\n # @persona.avatar = File.open('somewhere')\n @persona.save!\n @persona.avatar.url # => '/url/to/file.png'\n @persona.avatar.current_path # => 'path/to/file.png'\n @persona.avatar.identifier # => 'file.png'\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'Persona was successfully created.' }\n format.json { render json: @persona, status: :created, location: @persona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link_to_add_ingest_association(f, association)\n group = association.to_s.singularize\n label = I18n.t(\"ingest_form.#{group}.add\", :default => \"Add #{group}\")\n html = %Q|<span class=\"sr-only\">#{label}</span><i class=\"icon-plus icon-white\"></i>|\n return link_to_add_association(raw(html), f, association,\n :class => \"btn btn-success\",\n :title => label,\n :partial => \"ingest/ingest_fields\"\n )\n end",
"def find_or_create_faid\n faid = FindingAid.find_or_create_by(file.faid_attr)\n self.finding_aid_id = faid.id\n end",
"def add_doc_specific_attributes(filepath, is_src, attributes); end",
"def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end",
"def linkfile\n curfile = File.last_added(\"#{Downloads_path}/*.pdf\")\n unless curfile # no last file found\n growl(\"Sorry, no PDFs found in that directory\")\n exit(0)\n end\n\n f = MacTypes::FileURL.path(curfile)\n Selection[0].linked_files.add(f,{:to =>Selection[0]})\n Selection[0].auto_file\n\n growl(\"PDF added\", \"File added successfully to #{Selection[0].cite_key.get}\")\nend",
"def fave(favable)\n favorite_folder.add_favable(favable)\n end",
"def image_file_field(form_builder)\n image = form_builder.object\n form_builder.file_field :file, as: :file, class: 'image_file', id: 'image_files'\n end"
] | [
"0.62875324",
"0.6254998",
"0.6254998",
"0.61806726",
"0.6112793",
"0.5840082",
"0.58370537",
"0.5835645",
"0.583331",
"0.572393",
"0.57183",
"0.55866265",
"0.55843925",
"0.5563924",
"0.55342466",
"0.5517048",
"0.55154103",
"0.5514412",
"0.55128026",
"0.5508875",
"0.5505749",
"0.5496154",
"0.54870105",
"0.5468264",
"0.5449674",
"0.5439844",
"0.54265904",
"0.5418342",
"0.5417008",
"0.5414497",
"0.5406583",
"0.5402439",
"0.5402439",
"0.5401803",
"0.5401147",
"0.53957003",
"0.53853095",
"0.5376957",
"0.53723943",
"0.53677845",
"0.53639436",
"0.533515",
"0.5321582",
"0.53032345",
"0.53001434",
"0.5292265",
"0.5291263",
"0.52899903",
"0.5287944",
"0.5284264",
"0.52785563",
"0.5275699",
"0.52722764",
"0.5261772",
"0.526069",
"0.5248446",
"0.5248278",
"0.52472353",
"0.5246274",
"0.5241026",
"0.5239842",
"0.5228651",
"0.52222854",
"0.5221559",
"0.52213204",
"0.5205767",
"0.520543",
"0.5200921",
"0.5197552",
"0.51967216",
"0.51964647",
"0.5195737",
"0.5191457",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.5183794",
"0.51792574",
"0.517776",
"0.5172314",
"0.51714396",
"0.5171143",
"0.5169649",
"0.5161209",
"0.51604515",
"0.5159243",
"0.51549464",
"0.51528454",
"0.51447994",
"0.5139166",
"0.5135824",
"0.5132366",
"0.513209"
] | 0.55570686 | 14 |
No default implementation def set_default_payment_method(kb_account_id, kb_payment_method_id, properties, context) end | def get_payment_methods(kb_account_id, refresh_from_gateway = false, properties, context)
options = properties_to_hash(properties)
@payment_method_model.from_kb_account_id(kb_account_id, context.tenant_id).collect { |pm| pm.to_payment_method_info_plugin }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_payment_method(account_id, payment_method_id, opts = {})\n set_default_payment_method_with_http_info(account_id, payment_method_id, opts)\n return nil\n end",
"def default_payment_method\n payment_methods.find { |payment_instrument| payment_instrument.default? }\n end",
"def make_default!\n ::Stripe::Customer.update(customer.processor_id, {invoice_settings: {default_payment_method: processor_id}}, stripe_options)\n end",
"def set_as_default(payment_gateway_id, payment_method_id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'paymentGatewayId', payment_gateway_id)\n\t\t\tclient.add_param(kparams, 'paymentMethodId', payment_method_id)\n\t\t\tclient.queue_service_action_call('householdpaymentmethod', 'setAsDefault', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def set_default_payment_method_with_http_info(account_id, payment_method_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.set_default_payment_method ...\"\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling AccountsApi.set_default_payment_method\"\n end\n if @api_client.config.client_side_validation && account_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'account_id' when calling AccountsApi.set_default_payment_method, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # verify the required parameter 'payment_method_id' is set\n if @api_client.config.client_side_validation && payment_method_id.nil?\n fail ArgumentError, \"Missing the required parameter 'payment_method_id' when calling AccountsApi.set_default_payment_method\"\n end\n if @api_client.config.client_side_validation && payment_method_id !~ Regexp.new(/\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/)\n fail ArgumentError, \"invalid value for 'payment_method_id' when calling AccountsApi.set_default_payment_method, must conform to the pattern /\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+/.\"\n end\n\n # resource path\n local_var_path = \"/1.0/kb/accounts/{accountId}/paymentMethods/{paymentMethodId}/setDefault\".sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'paymentMethodId' + '}', payment_method_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'payAllUnpaidInvoices'] = opts[:'pay_all_unpaid_invoices'] if !opts[:'pay_all_unpaid_invoices'].nil?\n query_params[:'pluginProperty'] = @api_client.build_collection_param(opts[:'plugin_property'], :multi) if !opts[:'plugin_property'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#set_default_payment_method\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def payment_method\n @payment_method ||= PAYMENT_METHOD[mapping_for(:payment_method)]\n end",
"def payment_method\n @payment_method ||= PAYMENT_METHOD[mapping_for(:payment_method)]\n end",
"def set_as_default\n store = Breeze::Commerce::Store.first\n unless store.default_shipping_method\n store.default_shipping_method = self\n store.save\n end\n end",
"def save_payment_method(payment_method, default:)\n pay_payment_method = pay_customer.payment_methods.where(processor_id: payment_method.id).first_or_initialize\n\n attributes = Pay::Stripe::PaymentMethod.extract_attributes(payment_method).merge(default: default)\n\n # Ignore the payment method if it's already in the database\n pay_customer.payment_methods.where.not(id: pay_payment_method.id).update_all(default: false) if default\n pay_payment_method.update!(attributes)\n\n # Reload the Rails association\n pay_customer.reload_default_payment_method\n\n pay_payment_method\n end",
"def payment_method\n if payment_method_id.nil?\n return nil \n else\n @payment_method ||= Payments::PaymentMethod.get(payment_method_id.to_sym)\n end\n end",
"def get_default_payment_method\n @customer = get_braintree_customer\n return nil if @customer.nil?\n # get default payment_method of customer\n @customer.payment_methods.each do |payment|\n return payment if payment.default?\n end\n end",
"def set_person_default_payment\n @person_payment = PersonDefaultPayment.find(params[:id])\n end",
"def set_payment_method\n @payment_method = @user.payment_method.find(params[:id])\n end",
"def set_backoffice_payment_method\n @backoffice_payment_method = PaymentMethod.find(params[:id])\n end",
"def set_default\n self.member.payout_methods.active_only.each do |pm|\n pm.update_attribute(:default, false) if pm.default?\n end\n self.update_attribute(:default, true)\n end",
"def preferred_payment_method_name\n case self.preferred_payment_method.to_s\n when /debit/ then \"Zahlung per Lastschrift\"\n when /invoice/ then \"Zahlung per Rechnung\"\n when /paypal/ then \"Zahlung per Paypal\"\n end\n end",
"def set_payment_with!(method)\n\t\tself.update_column(:payment_method, method)\n\tend",
"def make_default!\n result = gateway.customer.update(customer.processor_id, default_payment_method_token: processor_id)\n raise Pay::Braintree::Error, result unless result.success?\n result.success?\n end",
"def make_default!\n result = gateway.customer.update(customer.processor_id, default_payment_method_token: processor_id)\n raise Pay::Braintree::Error, result unless result.success?\n result.success?\n end",
"def set_payment_method\n @payment_method = PaymentMethod.find(params[:id])\n end",
"def set_payment_method\n @payment_method = PaymentMethod.find(params[:id])\n end",
"def payment_method\n 'N/A'\n end",
"def set_payment_with!(method)\n\t\tself.update_columns(payment_method: method)\n\tend",
"def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'\n self.signature_digest_algorithm = :sha256\n self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'\n end",
"def set_payment_method\n @payment_method = PaymentMethod.find_by(id: params[:id],site_id: @site.id)\n redirect_to admin_errors_url(error_template: '403') unless @payment_method\n end",
"def assign_default_credit_card\n true\n end",
"def payment_method\n Zapi::Models::PaymentMethod.new\n end",
"def assign_default\n siblings.each do |s|\n if s.remote_data\n Braintree::PaymentMethod.update(s.vault_token, options: {make_default: false})\n s.update_column(:default, false)\n else\n # With no remote data, this method has been removed on the gateway. Mark it as dead.\n s.update_columns(default: false, status: 'removed')\n end\n end\n\n Braintree::PaymentMethod.update(vault_token, options: {make_default: true})\n self.default = true\n end",
"def set_user_payment_method\n @user_payment_method = UserPaymentMethod.find(params[:id])\n end",
"def add_default_account(post)\n post[:defaultacct] = 'Y'\n end",
"def default_bank; end",
"def clear_payment_method\n session[:payment_method] = nil\n end",
"def set_default\n end",
"def payment_class\n raise NotImplementedError\n end",
"def payment_method\n @payment_method ||= Gateway::AdyenHPP.last # find(params[:merchantReturnData])\n end",
"def payment_method\n self.payments.last.andand.payment_method || \"none\"\n end",
"def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def real_payment_method_name\n client_payments.last.payment_method.to_label rescue ''\n end",
"def default_bank=(_arg0); end",
"def set_default_rate\n currency_rates[base_currency] = DEFAULT_RATE\n end",
"def default_delivery_method=(delivery_method)\n @default_delivery_method = delivery_method\n end",
"def initialize\n @payment_method_service = SpreeQuickbooks::Services::PaymentMethod.new({})\n end",
"def payment_method(issuer,product =Cielo::PaymentMethod::CREDITO_A_VISTA,installment=1)\n return Cielo::PaymentMethod.new(issuer,product,installment)\n end",
"def payment_method=(payment_method)\n validator = EnumAttributeValidator.new('String', [\"Cheque\", \"Electronically\", \"Manual\"])\n unless validator.valid?(payment_method)\n fail ArgumentError, \"invalid value for \\\"payment_method\\\", must be one of #{validator.allowable_values}.\"\n end\n @payment_method = payment_method\n end",
"def provider_payment_gateway\n provider_account&.payment_gateway(sca: payment_detail.payment_method_id.present?)\n end",
"def and_default_to(default_method, &block)\n raise(ArgumentError, 'Default method is nil!') unless default_method\n raise(ArgumentError, 'Default method has already been specified!') if @default_method\n\n @default_method = default_method\n attempt(block)\n end",
"def backoffice_payment_method_params\n params.require(:payment_method).permit(:name, :logo, :logo_cache, :processor, :account, :key, :secret, :callback_url, :success_marks_as_paid, :pre_message, :post_message, :status)\n end",
"def payment_gateway(**options)\n return if payment_gateway_type.blank?\n\n PaymentGateway.implementation(payment_gateway_type, options).new(payment_gateway_options || {})\n end",
"def payment_type\n :credit_card\n end",
"def set_pay_method\n @pay_method = PayMethod.find(params[:id])\n end",
"def payment_type\n @payment_object ? PaymentMethod.payment_type(@payment_object) : @payment_type || :piggy_bank\n end",
"def method_type\n 'payone_cashinadvance'\n end",
"def define_default_method(object)\n object.__send__(:define_method, default_name, default_val)\n end",
"def initialize_defaults(method_name)\n end",
"def set_payment_mode\n @payment_mode = PaymentMode.find(params[:id])\n end",
"def set_conf_default(conf)\n end",
"def set_conf_default(conf)\n end",
"def create_payment_method\n @subscription.create_payment_method(payment_method_attrs)\n end",
"def payment_source_class\n nil\n end",
"def set_default_contact_method\n self.contact_methods = [{name: 'email', value: self.email}].to_json\n end",
"def method_type\n 'payone_ewallet'\n end",
"def set_defaults\n self.state ||= 'NEW'\n self.account_id ||= Gizmo::Util::Uuid.generate\n self.account_name ||= self.subdomain\n end",
"def set_default_options\n end",
"def payment_method_params\n params.require(:payment_method).permit(\n :name,\n :locale,\n :site_id,\n :payment_type_id,\n :active,\n :instructions,\n :summary_page_html,\n :user_mail_template_id,\n :admin_mail_template_id)\n end",
"def payment_type\n return \"none\" unless online_payment?\n\n if paypal_account?\n \"paypal\"\n elsif stripe_secret_key?\n if stripe_webhook_secret?\n \"advanced_stripe\"\n else\n \"stripe\"\n end\n else\n \"none\"\n end\n end",
"def default_card\n # noop\n end",
"def authen_method_none!()\n @authen_method = TAC_PLUS_AUTHEN_METH_NONE\n end",
"def get_account_payment_type\n self.le_account_payment_type.nil? ? \"\" : self.le_account_payment_type.name\n end",
"def payment_type=(value)\n @payment_type = value\n unless value == :piggy_bank\n# raise \"Only :piggy_bank is supported as payment type with this method. \" +\n# \"To use other payment types use @kase.payment_object = PaymentType.build(:visa)\"\n end\n end",
"def payment\n @payment ||= user.try(:payment_method).try(:to_payment)\n end",
"def set_usr_buyer_payment_method\n @usr_buyer_payment_method = UsrBuyerPaymentMethod.find(params[:id])\n end",
"def set_payment_provider\n @payment_provider = PaymentProvider.find(params[:id])\n end",
"def default_wallet_payment_source\n user.wallet_payment_sources.find_by(default: true)\n end",
"def payment_gateway_type=(type)\n gateway_setting.gateway_type = type\n end",
"def payment_methods(method, data = {})\n call_endpoint(Endpoint::PaymentMethods, method, data)\n end",
"def authen_method_notset!()\n @authen_method = TAC_PLUS_AUTHEN_METH_NOT_SET\n end",
"def payment_method(type)\n payment_method = payment_methods.actives.detect do |payment_method|\n payment_method.get_option('type') == type\n end\n if payment_method.nil?\n raise ArgumentError, \"Payment method #{type} is not found\"\n end\n payment_method\n end",
"def set_defaults\n if self.project.present?\n self.currency = self.project.account.account_setting.default_currency\n end\n \n self.quote_status = 0\n self.vat_rate = 20.0\n self.discount_percentage = 0.0\n self.new_quote = 1\n end",
"def create_first_payment\n make_payment\n end",
"def default_adapter_options=(_arg0); end",
"def default_adapter_options=(_arg0); end",
"def set_default(method_binding, default_value )\n defaults_for(method_binding.klass)[method_binding.operator] = default_value\n end",
"def after_initialize\n self.payment_type = if @payment_object \n PaymentMethod.payment_type(@payment_object)\n else\n @payment_type || :piggy_bank\n end\n self.build_payment_object_from_payment_type\n # Important! \n # reassign price, this time with sender's default currency\n self.price = @price_as_string if @price_as_string \n \n self.expires_at = self.kase.expires_at if self.kase && self.kase.expires_at\n end",
"def payment(method, data = {})\n call_endpoint(Endpoint::Payment, method, data)\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def set_payment_mode\n @payment_mode = PaymentMode.find(params[:id])\n end",
"def set_active_payment\n @payment ||= session[:payment_data][:billing_class].constantize.find(session[:payment_data][:billing_id])\n rescue\n render text: \"No valid payment\", status: 400\n end",
"def set_rental_payment_method\n @rental_payment_method = RentalPaymentMethod.find(params[:id])\n end",
"def default_adapter=(adapter); end",
"def default_adapter=(adapter); end",
"def default_adapter=(adapter); end",
"def payment_method=(payment_method)\n if payment_method.nil?\n fail ArgumentError, 'payment_method cannot be nil'\n end\n\n if payment_method.to_s.length > 35\n fail ArgumentError, 'invalid value for \"payment_method\", the character length must be smaller than or equal to 35.'\n end\n\n if payment_method.to_s.length < 1\n fail ArgumentError, 'invalid value for \"payment_method\", the character length must be great than or equal to 1.'\n end\n\n @payment_method = payment_method\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def set_default_country\n\t # get the country from the user profile -- that's the most logical match\n\t @profile = current_user.profile\n\t \n\t if @profile.country != \"\" then\t \n\t\t @customer.country = @profile.country\n\t else\n\t\t # if that's not available (country unknown) get it from browser variables\n\t\t set_country_from_http_accept_language\n\t end\n\t \n end",
"def propose_default_payment_execution(employee)\n if not employee.has_role?(:field_worker, employee.active_job_attachment)\n return nil\n end\n \n if self.pending_approval_grace_period_transactions.count != 0 \n return nil\n end\n \n # check whether it has the project assignment \n self.is_default_payment_resolution_proposed = true\n self.default_payment_proposer_id = employee.id \n self.save \n end",
"def payment\n order.credit_card || payment_empty\n end",
"def default_adapter=(adapter)\n @default_adapter = resolve_adapter(adapter)\n end",
"def payment(payment)\n raise NotImplementedError, \"TBK::Webpay::Logger::BaseLogger subclass must implement #payment method\"\n end"
] | [
"0.7330419",
"0.7126369",
"0.6978139",
"0.6938346",
"0.68741685",
"0.67230844",
"0.67230844",
"0.6504771",
"0.6471968",
"0.644956",
"0.6426105",
"0.6388055",
"0.6384869",
"0.635832",
"0.6334527",
"0.6278095",
"0.62151194",
"0.62001175",
"0.62001175",
"0.61107385",
"0.61107385",
"0.6037971",
"0.6030482",
"0.6011983",
"0.59822464",
"0.59762967",
"0.594903",
"0.59295523",
"0.58700866",
"0.5748717",
"0.56821084",
"0.56757903",
"0.5656035",
"0.5647378",
"0.56408787",
"0.563248",
"0.5610173",
"0.56066525",
"0.5599944",
"0.55671614",
"0.5548287",
"0.5527377",
"0.55203444",
"0.54685384",
"0.54626715",
"0.54595864",
"0.54588026",
"0.54485023",
"0.54323334",
"0.5429343",
"0.5428624",
"0.5400108",
"0.5397093",
"0.53949463",
"0.53892785",
"0.5389082",
"0.5389082",
"0.53674114",
"0.5361349",
"0.5360025",
"0.5349377",
"0.53415096",
"0.5339944",
"0.5336947",
"0.5321055",
"0.5319412",
"0.5306067",
"0.53037125",
"0.52925724",
"0.52913564",
"0.5289632",
"0.5289322",
"0.5283897",
"0.5280967",
"0.52592415",
"0.5259102",
"0.5250021",
"0.5244849",
"0.5238425",
"0.5237203",
"0.5237203",
"0.52264977",
"0.52259535",
"0.52199835",
"0.52195823",
"0.5194485",
"0.5184692",
"0.51834375",
"0.5178746",
"0.5178746",
"0.5178746",
"0.5173882",
"0.51684165",
"0.51684165",
"0.5166144",
"0.51651275",
"0.5139727",
"0.5138745",
"0.51327646"
] | 0.53484184 | 62 |
Utilities TODO Split settlements is partially implemented. Left to be done: payment_source should probably be retrieved per gateway amount per gateway should be retrieved from the options | def dispatch_to_gateways(operation, kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context, gateway_call_proc, linked_transaction_proc=nil, extra_params={})
kb_transaction = Utils::LazyEvaluator.new { get_kb_transaction(kb_payment_id, kb_payment_transaction_id, context.tenant_id) }
amount_in_cents = amount.nil? ? nil : to_cents(amount, currency)
# Setup options for ActiveMerchant
options = properties_to_hash(properties)
options[:order_id] ||= (Utils.normalized(options, :external_key_as_order_id) ? kb_transaction.external_key : kb_payment_transaction_id)
options[:currency] ||= currency.to_s.upcase unless currency.nil?
options[:description] ||= "Kill Bill #{operation.to_s} for #{kb_payment_transaction_id}"
# Retrieve the payment method
payment_source = get_payment_source(kb_payment_method_id, properties, options, context)
# Sanity checks
if [:authorize, :purchase, :credit].include?(operation)
raise "Unable to retrieve payment source for operation=#{operation}, kb_payment_id=#{kb_payment_id}, kb_payment_transaction_id=#{kb_payment_transaction_id}, kb_payment_method_id=#{kb_payment_method_id}" if payment_source.nil?
end
# Retrieve the previous transaction for the same operation and payment id - this is useful to detect dups for example
last_transaction = Utils::LazyEvaluator.new { @transaction_model.send("#{operation.to_s}s_from_kb_payment_id", kb_payment_id, context.tenant_id).last }
# Retrieve the linked transaction (authorization to capture, purchase to refund, etc.)
linked_transaction = nil
unless linked_transaction_proc.nil?
linked_transaction = linked_transaction_proc.call(amount_in_cents, options)
options[:payment_processor_account_id] ||= linked_transaction.payment_processor_account_id
end
# Filter before all gateways call
before_gateways(kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context)
# Dispatch to the gateways. In most cases (non split settlements), we only dispatch to a single gateway account
gw_responses = []
responses = []
transactions = []
payment_processor_account_ids = Utils.normalized(options, :payment_processor_account_ids)
if !payment_processor_account_ids
payment_processor_account_ids = [Utils.normalized(options, :payment_processor_account_id) || :default]
else
payment_processor_account_ids = payment_processor_account_ids.split(',')
end
payment_processor_account_ids.each do |payment_processor_account_id|
# Find the gateway
gateway = lookup_gateway(payment_processor_account_id, context.tenant_id)
# Filter before each gateway call
before_gateway(gateway, kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context)
# Perform the operation in the gateway
gw_response = gateway_call_proc.call(gateway, linked_transaction, payment_source, amount_in_cents, options)
response, transaction = save_response_and_transaction(gw_response, operation, kb_account_id, context.tenant_id, payment_processor_account_id, kb_payment_id, kb_payment_transaction_id, operation.upcase, amount_in_cents, currency, extra_params)
# Filter after each gateway call
after_gateway(response, transaction, gw_response, context)
gw_responses << gw_response
responses << response
transactions << transaction
end
# Filter after all gateways call
after_gateways(responses, transactions, gw_responses, context)
# Merge data
merge_transaction_info_plugins(payment_processor_account_ids, responses, transactions)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_opts(order, payment_method, stage)\n items = order.line_items.map do |item|\n price = (item.price * 100).to_i # convert for gateway\n { :name => item.variant.product.name,\n :description => (item.variant.product.description[0..120] if item.variant.product.description),\n :sku => item.variant.sku,\n :quantity => item.quantity,\n :amount => price,\n :weight => item.variant.weight,\n :height => item.variant.height,\n :width => item.variant.width,\n :depth => item.variant.weight }\n end\n\n credits = order.adjustments.map do |credit|\n if credit.amount < 0.00\n { :name => credit.label,\n :description => credit.label,\n :sku => credit.id,\n :quantity => 1,\n :amount => (credit.amount*100).to_i }\n end\n end\n\n credits_total = 0\n credits.compact!\n if credits.present?\n items.concat credits\n credits_total = credits.map {|i| i[:amount] * i[:quantity] }.sum\n end\n\n if params[:host_with_port].nil?\n params[:host_with_port] = request.host_with_port\n end\n\n opts = { :return_url => request.protocol + params[:host_with_port] + \"/confirm/\" + \"orders/#{order.number}/checkout/paypal_confirm?payment_method_id=#{payment_method}\",\n :cancel_return_url => request.protocol + params[:host_with_port] + \"/\" + \"orders/#{order.number}/edit\",\n :order_id => order.number,\n :custom => order.number,\n :items => items,\n :subtotal => ((order.item_total * 100) + credits_total).to_i,\n :tax => ((order.adjustments.map { |a| a.amount if ( a.source_type == 'Order' && a.label == 'Tax') }.compact.sum) * 100 ).to_i,\n :shipping => ((order.adjustments.map { |a| a.amount if a.source_type == 'Shipment' }.compact.sum) * 100 ).to_i,\n :money => (order.total * 100 ).to_i }\n\n # add correct tax amount by subtracting subtotal and shipping otherwise tax = 0 -> need to check adjustments.map\n opts[:tax] = (order.total*100).to_i - opts.slice(:subtotal, :shipping).values.sum\n\n if stage == \"checkout\"\n opts[:handling] = 0\n\n opts[:callback_url] = spree_root_url + \"paypal_express_callbacks/#{order.number}\"\n opts[:callback_timeout] = 3\n elsif stage == \"payment\"\n #hack to add float rounding difference in as handling fee - prevents PayPal from rejecting orders\n #because the integer totals are different from the float based total. This is temporary and will be\n #removed once Spree's currency values are persisted as integers (normally only 1c)\n opts[:handling] = (order.total*100).to_i - opts.slice(:subtotal, :tax, :shipping).values.sum\n end\n\n opts\n end",
"def payment_gateway_options\n gateway_setting.symbolized_settings\n end",
"def get_payment_options\n \n po = @data.payment_option\n\n options = PaymentMethod.options\n options.each do |option|\n method = option['pay_method']\n if po.pay_method == method\n option['checked'] = ' checked'\n option[\"pay_ref_#{method}\"] = po.pay_ref\n else\n option['checked'] = ''\n option[\"pay_ref_#{method}\"] = \"\"\n end\n end\n options\n end",
"def gateway_options\n options = { :email => order.email,\n :customer => order.email,\n :ip => order.last_ip_address,\n :order_id => gateway_order_id } # This is the changed line\n\n options.merge!({ :shipping => order.ship_total * 100,\n :tax => order.tax_total * 100,\n :subtotal => order.item_total * 100 })\n\n options.merge!({ :currency => currency })\n\n options.merge!({ :billing_address => order.bill_address.try(:active_merchant_hash),\n :shipping_address => order.ship_address.try(:active_merchant_hash) })\n\n options.merge!(:discount => promo_total) if respond_to?(:promo_total)\n options\n end",
"def payment_gateway_type\n gateway_setting.gateway_type\n end",
"def payment_gateway_options=(hash)\n gateway_setting.gateway_settings = hash\n end",
"def paypal_site_options(order) \n {}\n end",
"def update_params_payment_source\n if has_checkout_step?(\"payment\") && self.payment?\n if @updating_params[:payment_source].present?\n source_params = @updating_params.delete(:payment_source)[non_wallet_payment_method]\n\n if source_params\n non_wallet_payment_attributes(@updating_params[:order][:payments_attributes]).first[:source_attributes] = source_params\n end\n end\n\n if (@updating_params[:order][:payments_attributes])\n user = user_or_by_email\n # This method is overrided because spree add all order total in first payment, now after wallet we can have multiple payments.\n if user && available_wallet_payment_method\n wallet_payments = wallet_payment_attributes(@updating_params[:order][:payments_attributes])\n wallet_payments.first[:amount] = [remaining_total, user.store_credits_total].min if wallet_payments.present?\n @updating_params[:order][:payments_attributes] = wallet_payments if remaining_order_total_after_wallet(wallet_payments) <= 0\n non_wallet_payment_attributes(@updating_params[:order][:payments_attributes]).first[:amount] = remaining_order_total_after_wallet(wallet_payments) if non_wallet_payment_attributes(@updating_params[:order][:payments_attributes]).present?\n else\n @updating_params[:order][:payments_attributes].first[:amount] = remaining_total\n end\n end\n end\n @updating_params[:order]\n end",
"def prepare_authorize_params(source, gateway_options)\n order_number, payment_number = gateway_options[:order_id].split('-')\n order = Spree::Order.friendly.find order_number\n payment = Spree::Payment.friendly.find payment_number\n portion_value = Spree::KomerciConfig.calculate_portion_value order, gateway_options[:portions]\n total_value = sprintf('%0.2f', portion_value * gateway_options[:portions])\n\n year = source.year.to_s.last(2)\n month = source.month.to_s.rjust(2, '0')\n\n params = {\n total: total_value,\n filiacao: Spree::KomerciConfig[:afiliation_key],\n numpedido: \"#{order_number}-#{payment.id}\",\n nrcartao: source.number,\n cvc2: source.verification_value,\n mes: month,\n ano: year,\n portador: source.name,\n conftxn: 'S'\n }\n\n [:iata, :distribuidor, :concentrador, :taxaembarque, :entrada, :adddata, :add_data,\n :numdoc1, :numdoc2, :numdoc3, :numdoc4, :pax1, :pax2, :pax3, :pax4].each { |p| params[p] = nil }\n\n params\n end",
"def process_regular_subscription_payment(attributes = {})\n ::Nokogiri::XML::Builder.new(:encoding => \"utf-8\") do |xml|\n xml.send(\"soapenv:Envelope\", \"xmlns:soapenv\" => \"http://schemas.xmlsoap.org/soap/envelope/\", \"xmlns:v1\" => \"http://gpe.cz/pay/pay-ws/proc/v1\", \"xmlns:type\" => \"http://gpe.cz/pay/pay-ws/proc/v1/type\") {\n xml.send(\"soapenv:Header\")\n xml.send(\"soapenv:Body\") {\n xml.send(\"v1:processRegularSubscriptionPayment\") {\n xml.send(\"v1:regularSubscriptionPaymentRequest\") {\n xml.send(\"type:messageId\", attributes[:message_id])\n xml.send(\"type:provider\", \"0100\")\n xml.send(\"type:merchantNumber\", attributes[:merchant_number])\n xml.send(\"type:paymentNumber\", attributes[:order_number])\n xml.send(\"type:masterPaymentNumber\", attributes[:master_order_number])\n xml.send(\"type:orderNumber\", attributes[:merchant_order_number])\n xml.send(\"type:subscriptionAmount\", attributes[:amount])\n xml.send(\"type:captureFlag\", attributes[:capture_flag])\n xml.send(\"type:cardHolderData\") {\n xml.send(\"type:cardholderDetails\") {\n xml.send(\"type:name\", attributes[:card_holder_name])\n xml.send(\"type:email\", attributes[:card_holder_email])\n xml.send(\"type:phoneCountry\", attributes[:card_holder_phone_country])\n xml.send(\"type:phone\", attributes[:card_holder_phone])\n xml.send(\"type:mobilePhoneCountry\", attributes[:card_holder_mobile_phone_country])\n xml.send(\"type:mobilePhone\", attributes[:card_holder_mobile_phone])\n }\n xml.send(\"type:addressMatch\", attributes[:address_match])\n xml.send(\"type:billingDetails\") {\n xml.send(\"type:name\", attributes[:billing_name])\n xml.send(\"type:address1\", attributes[:billing_address1])\n xml.send(\"type:city\", attributes[:billing_city])\n xml.send(\"type:postalCode\", attributes[:billing_postal_code])\n xml.send(\"type:country\", attributes[:billing_country])\n }\n xml.send(\"type:shippingDetails\") {\n xml.send(\"type:name\", attributes[:shipping_name])\n xml.send(\"type:address1\", attributes[:shipping_address1])\n xml.send(\"type:city\", attributes[:shipping_city])\n xml.send(\"type:postalCode\", attributes[:shipping_postal_code])\n xml.send(\"type:country\", attributes[:shipping_country])\n }\n }\n xml.send(\"type:signature\", attributes[:digest])\n }\n }\n }\n }\n end.to_xml\n end",
"def getPaymentRequestTemplate\n {\n order_number: '',\n amount: 0,\n language: '',\n customer_ip: '',\n term_url: '',\n comments: '',\n billing: {\n name: '',\n address_line1: '',\n address_line2: '',\n city: '',\n province: '',\n country: '',\n postal_code: '',\n phone_number: '',\n email_address: ''\n },\n shipping: {\n name: '',\n address_line1: '',\n address_line2: '',\n city: '',\n province: '',\n country: '',\n postal_code: '',\n phone_number: '',\n email_address: ''\n },\n custom: {\n ref1: '',\n ref2: '',\n ref3: '',\n ref4: '',\n ref5: ''\n }\n }\n end",
"def payment_source_class\n nil\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << revenue_code\n service_payment_elements.join(@element_seperator )\n end",
"def before_gateways(kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil)\n end",
"def minimal_gateway_options\n {:email => order.user.email, \n :customer => order.user.email, \n :ip => order.ip_address, \n :order_id => order.number,\n :shipping => order.ship_amount * 100,\n :tax => order.tax_amount * 100, \n :subtotal => order.item_total * 100} \n end",
"def update_payment_amount(amount, source, gateway_options)\n if gateway_options[:portions] > 1\n portion_value = Spree::CieloConfig.calculate_portion_value amount, gateway_options[:portions]\n total_value = sprintf('%0.2f', portion_value * gateway_options[:portions])\n\n payment = Spree::Payment.find_by number: gateway_options[:order_id].split('-')[1]\n payment.update_attributes(amount: total_value)\n\n total_value\n else\n amount.to_s\n end\n end",
"def set_elements\n super\n # Vendor Tab\n element(:date_received_field) {b.text_field(:id => \"document.shipmentReceivedDate\")}\n element(:packing_slip_number_field) {b.text_field(:id => \"document.shipmentPackingSlipNumber\")}\n element(:bill_of_lading_number_field) {b.text_field(:id => \"document.shipmentBillOfLadingNumber\")}\n element(:reference_number_field) {b.text_field(:id => \"document.shipmentReferenceNumber\")}\n element(:carrier_selector) {b.select_list(:id => \"document.carrierCode\")}\n end",
"def payment_source_class\n ::Spree::PaymentSource::PAYONE::PayoneEWalletPaymentSource\n end",
"def build_merchant\n assign_wares\n # assign_merchant_image\n merchant_sayings\n end",
"def build_rate_plan_data(rate_plans, rate_plan_charges, rate_plan_charge_tiers, type)\n #the namespace\n ns = 'ins1'\n ns0 = 'ins0'\n builder = Builder::XmlMarkup.new\n xml = ''\n #build the xml\n rate_plans.each do |rp|\n #build a rate plan data for each rate plan that is passed in\n xml = builder.tag!(\"#{ns0}:RatePlanData\") {\n builder.tag!(\"#{ns0}:RatePlan\", \"xsi:type\" => \"#{ns}:RatePlan\") {\n if type == \"subscribe\"\n builder.tag!(\"#{ns}:ProductRatePlanId\", rp.values[:id])\n elsif type == 'amendment'\n builder.tag!(\"#{ns}:SubscriptionRatePlanId\", rp.values[:id])\n end\n #build the XML for the rate_plan_charges\n if rate_plan_charges != nil\n builder.tag!(\"#{ns0}:RatePlanChargeData\") {\n rate_plan_charges.each do |rpc|\n builder.tag!(\"#{ns0}:RatePlanCharge\", \"xsi:type\" => \"#{ns}:RatePlanCharge\") {\n if type == \"subscribe\"\n builder.tag!(\"#{ns}:ProductRatePlanChargeId\", rpc.values[:id])\n elsif type == 'amendment'\n builder.tag!(\"#{ns}:SubscriptionRatePlanChargeId\", rpc.values[:id])\n end\n #put in all the rate plan charge values in the call if its not the id \n rpc.symbol_to_string(rpc.values).each do |k,v|\n #TODO\n #FIX THIS\n if(k != 'Id' && !rpc.is_complex_type(k) && !rpc.is_read_only(k) && k != 'ProductRatePlanId')\n builder.tag!(\"#{ns}:#{k}\",v)\n end\n end\n #TODO\n #need to do a little processing here to figure out which tiers go with what charge\n #add tier data if necessary \n #if rate_plan_charge_tiers != nil\n # builder.tag!(\"#{ns0}:RatePlanChargeTierData\") {\n # rate_plan_charge_tiers.each do |rpct| \n # \n # builder.tag!(\"#{ns0}:RatePlanChargeTier\", \"xsi:type\" => \"#{ns}:RatePlanChargeTier\") {\n # }\n # end\n # }\n #end\n }\n end\n }\n end \n }\n\n }\n end\n xml\n end",
"def cc_payment_option\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(section.id(\"payment_options\").find.p.id(\"/creditcardselected/\"), __method__, self)\n\tend",
"def set_elements\n super\n # Circulation desk elements\n element(:circulation_desk_selector) {b.select_list(:id => 'LoanCirculationDesk_control')}\n element(:circulation_desk_yes) {b.button(:id => 'ChangeCirculationLocationBtn')}\n element(:circulation_desk_no) {b.button(:id => 'CirculationLocationCloseBtn')}\n # Loan Elements\n element(:patron_field) {b.text_field(:id => 'Patron-barcode_control')}\n element(:patron_search_button) {b.fieldset(:id => 'Patron-barcode_fieldset').input(:title => \"Search Field\")}\n element(:item_field) {b.text_field(:id => 'Patron-item_control')}\n element(:item_search_button) {b.fieldset(:id => 'Patron-item_fieldset').input(:title => \"Search Field\")}\n element(:fast_add_button) {b.button(:id => 'FastAddItemSectionLink')}\n element(:loan_popup_box) {b.div(:id => \"MessagePopupSection\")}\n element(:due_date_field) {b.text_field(:id => 'popUpDate_control')}\n element(:due_time_field) {b.text_field(:id => 'popUpTime_control')}\n element(:loan_button) {b.button(:id => 'loanBtn')}\n element(:do_not_loan_button) {b.button(:id => 'noLoanBtn')}\n # Current Item Elements\n element(:current_items_toggle) {b.a(:id => 'Patron-LoanItemListSection-HorizontalBoxSection_toggle').span}\n element(:checked_out_items_toggle) {b.a(:id => 'Patron-ExistingLoanItemListSection-HorizontalBoxSection_toggle').span}\n # General\n element(:loan_messages) {b.div(:id => 'LoanMessageFieldSection').spans(:class => 'uif-message')}\n element(:return_button) {b.button(:id => 'ReturnLinkView-buttons')}\n element(:header_close_button) {b.button(:id => 'headerDoneButton')}\n element(:header_clear_patron_button) {b.button(:id => 'headerClearPatronButton')}\n element(:header_alter_due_date_button) {b.button(:id => 'headerEditDueDateButton')}\n element(:header_claims_return_button) {b.button(:id => 'headerClaimsButton')}\n element(:header_renew_button) {b.button(:id => 'headerRenewalButton')}\n element(:clear_patron_button) {b.button(:id => 'clearPatronButton')}\n element(:close_button) {b.button(:id => 'doneButton')}\n element(:alter_due_date_button) {b.button(:id => 'editDueDateButton')}\n element(:claims_return_button) {b.button(:id => 'claimsButton')}\n element(:renew_button) {b.button(:id => 'renewalButton')}\n # Patron Details Area\n element(:patron_details_toggle) {b.a(:id => 'PatronDetailList-HorizontalBoxSection_toggle').span(:class => \"uif-headerText-span\")}\n element(:patron_name) {b.div(:id => 'patronName').a}\n element(:patron_type) {b.span(:id => 'patronType_control')}\n element(:patron_preferred_address) {b.span(:id => 'patronPreferredAddress_control')}\n element(:patron_phone_number) {b.span(:id => 'patronPhone_control')}\n element(:patron_email) {b.span(:id => 'patronEmail_control')}\n # Special\n element(:renewal_box) {b.div(:id => 'RenewalDueDateSection-HorizontalBoxSection')}\n end",
"def payment_gateway_type=(type)\n gateway_setting.gateway_type = type\n end",
"def find_or_build_gateway_setting\n (payment_gateway_setting || build_payment_gateway_setting)\n end",
"def process(txn, merchant_id, merchant_key)\n # Rails treats any blank field (x=\"\") as false (x=false), so any parameter that we wish to treat as optional\n # needs to be given a default value of \"\" here.\n optional = [:shipping]\n optional.each { |key| txn[key] ||= \"\" } # if it has a nil or false value, give it \"\" instead.\n\n=begin\n 1. ICT 220 – B&W IP Incendo Terminal\n APPID: INGETERMICT2200COUNAAE8USEN\n\n 2. ICT 250 – Color Incendo Terminal\n APPID: INGETERMICT2500COUNAAE9USEN\n=end\n\n @t_device_id = txn[:itid]\n\n case txn[:model]\n when 'ICT220' then @t_application_id = \"INGETERMICT2200COUNAAE8USEN\"\n when 'ICT250' then @t_application_id = \"INGETERMICT2500COUNAAE9USEN\"\n end\n\n\n\n\n\n # Kalopsia expects dates to be Date objects, but they might be Strings.\n dates = [:card_expiry_date, :start_date, :end_date]\n dates.each do |date_key|\n if txn[date_key].kind_of?(String)\n txn[date_key] = DateTime.parse(txn[date_key])\n end\n end\n\n actions = %w(sale sale_return pre_auth post_pre_auth force_sale void void_by_ton settlement batch_inquiry view_detail view_open view_settled)\n case txn[:action]\n when 'sale'\n case txn[:card_mode]\n when 'debit' then do_debit_sale(txn, merchant_id, merchant_key )\n when 'credit' then do_credit_sale(txn, merchant_id, merchant_key)\n else raise \"invalid card mode: #{txn[:card_mode]} (expected one of 'debit', 'credit')\"\n end\n when 'sale_return' then do_sale_return(txn, merchant_id, merchant_key)\n when 'pre_auth' then do_pre_auth(txn, merchant_id, merchant_key)\n when 'post_pre_auth' then do_post_pre_auth_http(txn, merchant_id, merchant_key)\n when \"force_sale\" then do_force_sale(txn, merchant_id, merchant_key)\n when \"void\" then do_void(txn, merchant_id, merchant_key)\n when \"void_by_ton\" then do_void_by_ton(txn, merchant_id, merchant_key)\n when \"settlement\" then do_settlement(txn, merchant_id, merchant_key)\n when \"batch_inquiry\" then do_batch_inquiry(txn, merchant_id, merchant_key)\n when \"view_detail\" then view_bankcard_settled_batch_detail(txn, merchant_id, merchant_key)\n when \"view_open\" then view_current_open_batch_listing(txn,merchant_id, merchant_key)\n when \"view_settled\" then view_settled_batch_summary(txn,merchant_id, merchant_key)\n else raise \"action not found: #{txn[:action]} (expected one of #{actions.inspect})\"\n end\n end",
"def object_params\n if params[:payment_source].present? && source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]\n params[:order][:payments_attributes].first[:source_attributes] = source_params\n end\n if (params[:order][:payments_attributes])\n params[:order][:payments_attributes].first[:amount] = @order.total\n end\n params[:order]\n end",
"def select_funding_sources(data_set)\n funding_sources = data_set[Acquisition::ACQUIS_FUNDING_LIST.name]\n funding_sources && funding_sources.each do |source|\n index = funding_sources.index source\n add_button_locator = add_button_locator([fieldset(Acquisition::ACQUIS_FUNDING_SOURCE.name)])\n source_options_locator = input_options_locator([fieldset(Acquisition::ACQUIS_FUNDING_SOURCE.name, index)])\n wait_for_element_and_click add_button_locator unless index.zero?\n enter_auto_complete(funding_source_input_locator(index), source_options_locator, source[Acquisition::ACQUIS_FUNDING_SOURCE.name])\n end\n end",
"def payment_source_class\n ::Spree::PaymentSource::PAYONE::PayoneCashInAdvancePaymentSource\n end",
"def set_payment_option\n @payment_option = PaymentOption.find(params[:id])\n end",
"def purchase_options\n {\n :billing_address => {\n :address1 => @address,\n :city => @city,\n :state => @state,\n :country => \"US\",\n :zip => @zip\n }\n }\n end",
"def build_payment_mechanism(xml, credit_card)\n xml.PaymentMech{\n xml.CreditCard{\n type = credit_card.type\n xml.Type(CARDS[type.to_sym] || 1, :DataType=>\"S32\")\n xml.Number(credit_card.number)\n #TODO: only takes 2 digit year and month\n #xml.Expires(\"#{credit_card.year}/#{credit_card.month}\", :DataType=>\"ExpirationDate\", :Locale=>\"826\") \n xml.Expires(\"10/10\", :DataType=>\"ExpirationDate\", :Locale=>\"826\") \n \n if not credit_card.start_year.nil? or not credit_card.start_month.nil?\n xml.StartDate(\"#{credit_card.start_year}/#{credit_card.start_month}\", :DataType=>\"StartDate\", :Local=>\"826\") \n end\n if not credit_card.issue_number.nil?\n xml.IssueNum(credit_card.issue_number)\n end\n if not credit_card.verification_value.nil?\n xml.Cvv2Indicator(\"1\")\n xml.Cvv2Indicator(credit_card.verification_value)\n end\n }\n }\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => name,\n :address1 => address,\n :city => city,\n :state => state,\n :country => country,\n :zip => zip\n }\n }\n end",
"def payment_url_for_payment(payment)\n if @payment_method.blank? || CARD_METHODS.include?(@payment_method)\n nil\n else\n existing_transaction = MakeCommerceRequest.where(payment_id: payment.id).last\n\n if existing_transaction.present?\n # Transaction has already been prepared in MakeCommerce environment\n # Load payment service url from shop enabled methods hash\n url = (payment_method_hash(shop_payment_methods, @payment_method, @country_code) || {})[:url]\n url_with_transaction(url, existing_transaction.external_transaction_key) if url.present?\n else\n # Prepare transaction in MakeCommerce environment\n transaction = client.create_transaction(payload_for_transaction(payment))\n\n if transaction.present? && transaction[:status] == 'CREATED'\n MakeCommerceRequest.where(payment_id: payment.id, external_transaction_key: transaction[:id], payment_method: @payment_method)\n # Load payment service url from transaction enabled methods hash\n (payment_method_hash(transaction[:payment_methods][:banklinks], @payment_method, @country_code) || {})[:url]\n end\n end\n end\n end",
"def order_opts(order)\n items = order.line_items.map do |item|\n tax = paypal_variant_tax(item.price, item.variant)\n price = (item.price * 100).to_i # convert for gateway\n tax = (tax * 100).to_i # truncate the tax slice\n { :name => item.variant.product.name,\n :description => item.variant.product.description[0..120],\n :sku => item.variant.sku,\n :qty => item.quantity, \n :amount => price - tax, \n :tax => tax,\n :weight => item.variant.weight,\n :height => item.variant.height,\n :width => item.variant.width,\n :depth => item.variant.weight }\n end\n\n opts = { :return_url => request.protocol + request.host_with_port + \"/orders/#{order.number}/paypal_finish\",\n :cancel_return_url => \"http://\" + request.host_with_port + \"/orders/#{order.number}/edit\",\n :order_id => order.number,\n :custom => order.number,\n\n :items => items,\n }\n opts\n end",
"def pay!\n #soap_server = VendorPayment.generate_soap_server\n #token = VendorPayment.generate_usa_epay_security_token\n #custNum = observed.vendor_payment_period.store.id\n #paymentMethodID = nil\n #parameters = generate_transaction_request\n #response = soap_server.runCustomerTransaction(token, custNum, paymentMethodID, parameters)\n #\n if self.vendor_payment_period.store.usa_epay_customer_number.blank?\n self.errors['usa_epay_customer_number'] = \"The USA ePay custNum must be set before a payment can be made.\"\n return\n end\n gateway = VendorPayment.gateway\n payment_methods_response = gateway.get_customer_payment_methods(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number)\n monthly_transfer_method = nil\n items = if payment_methods_response.params['get_customer_payment_methods_return']\n payment_methods_response.params['get_customer_payment_methods_return']['item']\n else\n []\n end\n \n if items.is_a?(Hash)\n items = [items]\n end\n \n items.each do |payment_method|\n if payment_method['method_name'].strip == 'Monthly ACH Transfer'\n monthly_transfer_method = payment_method\n end\n end\n \n if monthly_transfer_method\n response = gateway.run_customer_transaction(:customer_number => self.vendor_payment_period.store.usa_epay_customer_number,\n :command => 'CheckCredit',\n # USA ePay does pennies for the amount, so it needs to be\n # multiplied by 100\n :payment_method_id => monthly_transfer_method['method_id'],\n :amount => self.amount * 100)\n \n \n self.state = if response.message['result_code'].strip == 'A'\n VendorPayment.status_codes[response.message['status_code']]\n else\n VendorPayment.status_codes[\"E\"]\n end\n self.response_data = YAML::dump(response)\n if !response.message['ref_num'].blank?\n self.response_code = response.message['ref_num']\n save\n else\n save\n self.errors['transaction'] = \"State: #{self.state}. There was an error with code #{response.message['error_code']}, while trying to make the payment. Check USA ePay for reference number #{response.message['ref_num']} if necessary.\\n\\nFull Message: #{response.message.inspect}\"\n end\n self.vendor_payment_period.update_payment_total!\n self.vendor_payment_period.update_state!\n else\n self.errors['payment_method'] = \"There is no payment method on the vendor called 'Monthly ACH Transfer'\"\n end\n end",
"def subscribe_with_rateplan_data_to_xml(account, contact, subscription, payment_method, subscribe_options, preview_options, rate_plans, rate_plan_charges, rate_plan_charge_tiers, type)\n #the namespace\n ns = 'ins1'\n ns0 = 'ins0'\n builder = Builder::XmlMarkup.new\n #build the XML\n xml = builder.tag!(\"ins0:subscribes\") {\n #account can be just an id to subscribe to existing\n builder.tag!(\"ins0:Account\", \"xsi:type\" => \"ins1:Account\") {\n #put all the account values in the call\n account.symbol_to_string(account.values).each do |k,v|\n builder.tag!(\"ins1:#{k}\",v)\n end\n }\n #payment method\n builder.tag!(\"ins0:PaymentMethod\", \"xsi:type\" => \"ins1:PaymentMethod\") {\n #put all the paymnet method values in the call\n payment_method.symbol_to_string(payment_method.values).each do |k,v|\n builder.tag!(\"ins1:#{k}\",v)\n end\n }\n #bill to contact\n builder.tag!(\"ins0:BillToContact\", \"xsi:type\" => \"ins1:BillToContact\") {\n #put all the contact values in the call\n contact.symbol_to_string(contact.values).each do |k,v|\n builder.tag!(\"ins1:#{k}\",v)\n end\n }\n #preview options\n builder.tag!(\"ins0:PreviewOptions\") {\n builder.tag!(\"ins0:EnablePreviewMode\", false)\n builder.tag!(\"ins0:NumberOfPeriods\", 1)\n }\n #TODO\n #ADD SUPPORT FOR SOLD TO\n #sold to contact, if only one BillTo defaults to SoldTo\n\n #subscribe options \n builder.tag!(\"ins0:SubscribeOptions\") {\n builder.tag!(\"ins0:GenerateInvoice\", false)\n builder.tag!(\"ins0:ProcessPayments\", false)\n builder.tag!(\"ins0:SubscribeInvoiceProcessingOptions\"){\n builder.tag!(\"ins0:InvoiceProcessingScope\", \"subscription\")\n }\n }\n #subscription data\n builder.tag!(\"ins0:SubscriptionData\") {\n #subscription\n builder.tag!(\"ins0:Subscription\", \"xsi:type\" => \"ins1:Subscription\"){\n #put in all the subscription values in the call\n subscription.symbol_to_string(subscription.values).each do |k,v|\n builder.tag!(\"ins1:#{k}\",v)\n end\n }\n #rate plan data\n #WILL NEED TO MAKE A NEW ONE OF THESE FOR EACH PRODUCT RATE PLAN ID\n rate_plans.each do |rp|\n #build a rate plan data for each rate plan that is passed in\n builder.tag!(\"#{ns0}:RatePlanData\") {\n builder.tag!(\"#{ns0}:RatePlan\", \"xsi:type\" => \"#{ns}:RatePlan\") {\n if type == \"subscribe\"\n builder.tag!(\"#{ns}:ProductRatePlanId\", rp.values[:id])\n elsif type == 'amendment'\n builder.tag!(\"#{ns}:SubscriptionRatePlanId\", rp.values[:id])\n end\n #build the XML for the rate_plan_charges\n if rate_plan_charges != nil\n builder.tag!(\"#{ns0}:RatePlanChargeData\") {\n rate_plan_charges.each do |rpc|\n builder.tag!(\"#{ns0}:RatePlanCharge\", \"xsi:type\" => \"#{ns}:RatePlanCharge\") {\n if type == \"subscribe\"\n builder.tag!(\"#{ns}:ProductRatePlanChargeId\", rpc.values[:id])\n elsif type == 'amendment'\n builder.tag!(\"#{ns}:SubscriptionRatePlanChargeId\", rpc.values[:id])\n end\n #put in all the rate plan charge values in the call if its not the id \n rpc.symbol_to_string(rpc.values).each do |k,v|\n #TODO\n #FIX THIS\n if(k != 'Id' && !rpc.is_complex_type(k) && !rpc.is_read_only(k) && k != 'ProductRatePlanId')\n builder.tag!(\"#{ns}:#{k}\",v)\n end\n end\n #TODO\n #need to do a little processing here to figure out which tiers go with what charge\n #add tier data if necessary \n #if rate_plan_charge_tiers != nil\n # builder.tag!(\"#{ns0}:RatePlanChargeTierData\") {\n # rate_plan_charge_tiers.each do |rpct| \n # \n # builder.tag!(\"#{ns0}:RatePlanChargeTier\", \"xsi:type\" => \"#{ns}:RatePlanChargeTier\") {\n # }\n # end\n # }\n #end\n }\n end\n }\n end \n }\n\n }\n end\n }\n }\n end",
"def service_payment_information\n service_payment_elements =[]\n service_payment_elements << 'SVC'\n service_payment_elements << composite_med_proc_id\n service_payment_elements << service.amount('service_procedure_charge_amount')\n service_payment_elements << service.amount('service_paid_amount')\n service_payment_elements << svc_revenue_code\n service_payment_elements << service.service_quantity.to_f.to_amount\n service_payment_elements = Output835.trim_segment(service_payment_elements)\n service_payment_elements.join(@element_seperator )\n end",
"def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => \"#{billing_address.first_name} #{billing_address.last_name}\",\n :address1 => billing_address.address,\n :city => billing_address.city,\n :state => billing_address.state,\n :country => \"US\",\n :zip => billing_address.zip\n },\n :tax => tax_in_cents,\n :order_id => self.id\n }\n end",
"def SetFuelCostRates( fuelName, houseElements, fuelElements, theValue )\n\n locationFuelText = \"FuelCosts/#{fuelName}/Fuel\"\n\n fuelElements.each(locationFuelText) do |element|\n\n # This code allows for the \"auto\" case that matches the fuel lib name with the\n # location name AS WELL AS the case when the fuel name matches some other name in\n # the fuel lib. The unmatched case could be used to evaluate different fuel rate\n # structures in one weather location. Note that Opt-Location must be set in the choice\n # file for \"auto\" to work (it is assigned to $Locale above, so order also matters)!\n if ( (theValue == \"auto\" && element.get_text(\"Label\") == $Locale) || element.get_text(\"Label\") == theValue)\n\n # Get fuel ID# from fuel library to save in house\n fuelId = element.attributes[\"id\"]\n houseElements[\"HouseFile/FuelCosts/#{fuelName}/Fuel\"].attributes[\"id\"] = fuelId\n\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/Label\"\n houseElements[locationText].text = element.get_text(\"Label\")\n\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/Units\"\n houseElements[locationText].attributes[\"code\"] = element[5].attributes[\"code\"]\n\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/Minimum\"\n houseElements[locationText].attributes[\"units\"] = element[7].attributes[\"units\"]\n houseElements[locationText].attributes[\"charge\"] = element[7].attributes[\"charge\"]\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/RateBlocks/Block1\"\n houseElements[locationText].attributes[\"units\"] = element[9][1].attributes[\"units\"]\n houseElements[locationText].attributes[\"costPerUnit\"] = element[9][1].attributes[\"costPerUnit\"]\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/RateBlocks/Block2\"\n houseElements[locationText].attributes[\"units\"] = element[9][3].attributes[\"units\"]\n houseElements[locationText].attributes[\"costPerUnit\"] = element[9][3].attributes[\"costPerUnit\"]\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/RateBlocks/Block3\"\n houseElements[locationText].attributes[\"units\"] = element[9][5].attributes[\"units\"]\n houseElements[locationText].attributes[\"costPerUnit\"] = element[9][5].attributes[\"costPerUnit\"]\n locationText = \"HouseFile/FuelCosts/#{fuelName}/Fuel/RateBlocks/Block4\"\n houseElements[locationText].attributes[\"units\"] = element[9][7].attributes[\"units\"]\n houseElements[locationText].attributes[\"costPerUnit\"] = element[9][7].attributes[\"costPerUnit\"]\n\n end # Matches wth locale OR simple name match\n\n end # End of fuel element loop\n\nend",
"def payment_methods\n request = payment_methods_request\n response = PaybywayConnector.payment_methods(request).parsed_response\n response['payment_methods'].map { |method|\n PaymentGateway::PaymentMethod.new(\n group: method['group'].to_sym,\n name: method['name'],\n slug: method['selected_value'],\n min_cents: method['min_amount'],\n max_cents: method['max_amount'],\n image_url: method['img']\n )\n }\n end",
"def set_fields result\n @txn.confirmation_no = result.id \n if CREDIT_CARD_API == 'balanced'\n @txn.payment_type, @txn.credit_card_no, @txn.debit_token = result.source.card_type, result.source.last_four, result.uri\n else\n @txn.payment_type, @txn.credit_card_no, @txn.debit_token = result.source.brand, result.source.last4, result.source.id\n end\n end",
"def object_params\n # respond_to check is necessary due to issue described in #2910\n if params[:payment_source].present?\n source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]\n\n if source_params\n params[:order][:payments_attributes].first[:source_attributes] = source_params\n end\n end\n\n if (params[:order][:payments_attributes])\n params[:order][:payments_attributes].first[:amount] = @order.total\n end\n params[:order]\n end",
"def before_gateway(gateway, kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil)\n # Can be used to implement idempotency for example: lookup the payment in the gateway\n # and pass options[:skip_gw] if the payment has already been through\n end",
"def set_payment_gateway\n @payment_gateway = PaymentGateway.find_by(id: params[:id],site_id: @site.id)\n redirect_to admin_errors_url(error_template: '403') unless @payment_gateway\n end",
"def select_funding_sources(data_set)\n fundings = data_set[CoreAcquisitionData::ACQUIS_FUNDING_LIST.name]\n fundings && fundings.each do |funding|\n index = fundings.index funding\n logger.debug \"Entering funding source #{funding} at index #{index}\"\n add_button_locator = add_button_locator([fieldset(CoreAcquisitionData::ACQUIS_FUNDING_LIST.name)])\n funding_source_options_locator = input_options_locator([fieldset(CoreAcquisitionData::ACQUIS_FUNDING_LIST.name, index)], CoreAcquisitionData::ACQUIS_FUNDING_SOURCE.name)\n wait_for_element_and_click add_button_locator unless index.zero?\n enter_auto_complete(funding_source_input_locator(index), funding_source_options_locator, funding[CoreAcquisitionData::ACQUIS_FUNDING_SOURCE.name], 'Local Persons')\n end\n end",
"def settle_payments_if_desired\n @settlement_results = { \"errors\" => [], \"status\" => [] }\n\n op = nil\n\n unless @order.canceled?\n while options[\"ok_capture\"] && @order.outstanding_balance > 0 && op = pick_payment { |opp| opp.pending? && opp.amount > 0 && opp.amount <= @order.outstanding_balance }\n rescue_gateway_error { op.capture! }\n end\n\n while options[\"ok_partial_capture\"] && @order.outstanding_balance > 0 && op = pick_payment { |opp| opp.pending? && opp.amount > 0 && opp.amount > @order.outstanding_balance }\n # Spree 2.2.x allows you to pass an argument to\n # Spree::Payment#capture! but this does not seem to do quite\n # what we want. In particular the payment system treats the\n # remainder of the payment as pending.\n op.amount = @order.outstanding_balance\n rescue_gateway_error { op.capture! }\n end\n\n while options[\"ok_void\"] && @order.outstanding_balance <= 0 && op = pick_payment { |opp| opp.pending? && opp.amount > 0 }\n rescue_gateway_error { op.void_transaction! }\n end\n\n while options[\"ok_refund\"] && @order.outstanding_balance < 0 && op = pick_payment { |opp| opp.completed? && opp.can_credit? }\n rescue_gateway_error { op.credit! } # remarkably, THIS one picks the right amount for us\n end\n end\n\n # collect payment data\n @order.payments.select{|op| op.amount > 0}.each do |op|\n @settlement_results[\"status\"] << { \"id\" => op.id, \"state\" => op.state, \"amount\" => op.amount, \"credit\" => op.offsets_total.abs }\n end\n end",
"def gateway\n ActiveMerchant::Billing::Base.mode = :test\n\n @gateway ||= \n ActiveMerchant::Billing::PaypalRecurringGateway.new(\n :login => 'nk_tes_1218714620_biz_api1.mail.ru',\n :password => '1218714626',\n :signature => 'An5ns1Kso7MWUdW4ErQKJJJ4qi4-A-b1ANj9g14qW6XOboBut7nnhDdn'\n )\n @gateway\n end",
"def set_prepaid_constants\n\n @atm_owner_fee = 2.50 #fee charged by ATM owners\n\n @direct_dep = false #true -- has direct depoist. Values: true or false, case doesn't matter\n @wkly_trans = 8 #number of signature transactions\n @wkly_atm_in_net = 1 #number of atm in network cash withdrawels\n @wkly_atm_out_net = 0 #number of atm out of network cash withdrawals \n @mthly_load = 1000 #average cash loaded to card\n @mthly_loads = 0 #number of loads\n @wkly_atm_inq = 0 #number of atm balance inquiries\n @calls = 0 #live customer service per month \n @prepaid_duration = 24 #numner of months keeping the card \n\n @max_wkly_purchase = 20\n @max_wkly_atm_in_net = 10 #number of atm cash withdrawels\n @max_wkly_atm_out_net = 10 #number of atm cash withdrawels \n @max_mthly_load = 4000 # total amount of cash loaded onto card\n @max_mthly_loads = 8 #number of loads\n @max_wkly_atm_inq = 10 #number of atm balance inquiries\n @max_calls = 10 #number of calls to customer service per month\n @max_prepaid_duration = 48 #length of ownership\n\n end",
"def set_elements\n super\n element(:purchase_order_number_field) {b.text_field(:id => \"document.purchaseOrderIdentifier\")}\n element(:invoice_number_field) {b.text_field(:id => \"document.invoiceNumber\")}\n element(:invoice_date_field) {b.text_field(:id => \"document.invoiceDate\")}\n element(:invoice_amount_field) {b.text_field(:id => \"document.vendorInvoiceAmount\")}\n element(:special_handling_line_1) {b.text_field(:id => \"document.specialHandlingInstructionLine1Text\")}\n element(:special_handling_line_2) {b.text_field(:id => \"document.specialHandlingInstructionLine2Text\")}\n element(:special_handling_line_3) {b.text_field(:id => \"document.specialHandlingInstructionLine3Text\")}\n element(:foreign_invoice_amount_field) {b.text_field(:id => \"document.foreignVendorInvoiceAmount\")}\n element(:continue_button) {b.div(:id => \"globalbuttons\").input(:title => \"Continue\")}\n element(:clear_button) {b.div(:id => \"globalbuttons\").input(:title => \"Clear\")}\n end",
"def set_elements\n super\n # View Related Documents Tab\n element(:view_related_tab_toggle) {b.input(:id => \"tab-ViewRelatedDocuments-imageToggle\")}\n element(:view_related_po_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Purchase Order')]/a\")}\n element(:view_related_requisition_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Requisition')]/a\")}\n # Delivery Tab\n element(:delivery_tab_toggle) {b.input(:id => \"tab-Delivery-imageToggle\")}\n element(:building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_room_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[5]/td[1]\")}\n element(:closed_building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:closed_campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_address_1_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[1]\")}\n element(:closed_address_2_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[4]/th[1]/following-sibling::td[1]\")}\n element(:closed_city_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[6]/th[1]/following-sibling::td[1]\")}\n element(:closed_state_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[7]/th[1]/following-sibling::td[1]\")}\n element(:closed_postal_code_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[8]/th[1]/following-sibling::td[1]\")}\n element(:closed_country_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[9]/th[1]/following-sibling::td[1]\")}\n element(:closed_delivery_to_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[2]\")}\n element(:closed_delivery_phone_number_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[2]\")}\n element(:closed_email_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[2]\")}\n # Vendor Tab\n element(:vendor_tab_toggle) {b.input(:id => \"tab-Vendor-imageToggle\")}\n element(:closed_vendor_name_field) {b.td(:xpath => \"//tr/th[div[contains(text(),'Suggested Vendor:')]]/following-sibling::td[1]\")}\n # Route Log Tab\n element(:route_log_tab_toggle) {b.input(:id => \"tab-RouteLog-imageToggle\")}\n # element(:actions_taken) {b.bs(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[1]/b\")}\n # element(:actions_taken_by) {b.as(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[2]/a\")}\n end",
"def test_merchant_description\n merchant_options = {\n merchantInformation: {\n merchantDescriptor: {\n name: 'Test Name',\n address1: '123 Main Dr',\n locality: 'Durham'\n }\n }\n }\n\n assert response = @gateway.purchase(@amount, @credit_card, @options.merge(merchant_options))\n assert_successful_response(response)\n end",
"def payment_gateway(**options)\n return if payment_gateway_type.blank?\n\n PaymentGateway.implementation(payment_gateway_type, options).new(payment_gateway_options || {})\n end",
"def payment\n # FIXME: please constantize the step numbers!\n @step = 5\n session[:step] = 5 if (session[:step].nil? || session[:step] < 5)\n @tipsters = Tipster.where(id: tipster_ids_in_cart)\n unless current_subscriber.subscription.present?\n @subscription = current_subscriber.build_subscription(plan_id: session[:plan_id])\n else\n @subscription = current_subscriber.subscription\n end\n @subscription.tipsters = @tipsters unless current_subscriber.already_has_subscription?\n @subscription.plan = selected_plan\n @subscription.using_coupon = true if using_coupon?\n @subscription.active = false\n @subscription.save\n @subscription.set_primary(tipster_ids_in_cart.first.to_i)\n\n if request.post?\n if params[:is_one_shoot] == \"true\"\n @subscription.update_attributes(is_one_shoot: true)\n elsif params[:is_one_shoot] == \"false\"\n @subscription.update_attributes(is_one_shoot: false)\n end\n if params[:method] == Payment::BY_PAYPAL\n ret = @subscription.generate_paykey\n if ret[:success]\n paykey = ret[:paykey]\n @paypal = {\n amount: \"%05.2f\" % @subscription.calculator_price,\n currency: \"EUR\",\n item_number: current_subscriber.id,\n paykey: paykey,\n item_name: \"TIPSTER HERO SUBSCRIPTION\"\n }\n respond_to do |format|\n format.js { render 'paypalinit.js.haml' }\n end\n else\n logger = Logger.new('log/payment_error.log')\n logger.info(\"CREATE PAYKEY FAILER\")\n logger.info(ret[:message])\n render js: 'window.location = '/''\n end\n else\n puts \"FRENCH BANK HERE\"\n end\n end\n\n end",
"def form_setup\n\t\t@plans = SubscriptionPlan.all.map { |plan| [plan.name_and_amount, plan.id] }\n\tend",
"def object_params\n # For payment step, filter order parameters to produce the expected nested attributes for a single payment and its source, discarding attributes for payment methods other than the one selected\n\n if @order.has_checkout_step?(\"payment\") && @order.payment?\n if params[:payment_source].present?\n source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]\n\n if params[:existing_card]\n credit_card = Spree::CreditCard.find(params[:existing_card])\n authorize! :manage, credit_card\n params[:order][:payments_attributes].first[:source] = credit_card\n else\n if source_params\n params[:order][:payments_attributes].first[:source_attributes] = source_params\n end\n end\n end\n if (params[:order][:payments_attributes])\n params[:order][:payments_attributes].first[:amount] = @order.total\n end\n end\n \n if params[:order]\n params[:order].permit(permitted_checkout_attributes)\n else\n {}\n end\n\n end",
"def index\n @payment_gateways = PaymentGateway.where(site_id: @site.id)\n end",
"def paypal_gateway\n gw_defaults = { :ppx_class => \"ActiveMerchant::Billing::PaypalExpressUkGateway\" }\n gw_opts = gw_defaults.merge(paypal_site_options @order)\n \n begin \n requires!(gw_opts, :ppx_class, :login, :password, :signature)\n rescue ArgumentError => err\n raise ArgumentError.new(<<\"EOM\" + err.message)\nProblem with configuring Paypal Express Gateway:\nYou need to ensure that hook \"paypal_site_options\" sets values for login, password, and signature.\nIt currently produces: #{paypal_site_options.inspect}\nEOM\n end \n\n gateway = gw_opts[:ppx_class].constantize.new(gw_opts)\n end",
"def select_options(offer)\n puts \"basepage select options\"\n @offer = offer.first\n begin\n @steps_loc = get_locators()\n puts \"steps_loc loc\"\n puts @steps_loc\n puts \"loc done\"\n rescue => e\n e.display\n end\n begin\n pages = get_pattern\n puts \"pages\"\n puts pages\n puts \"pages done\"\n Rails.logger.info pages\n pages.each do |page|\n puts \"page\"\n puts page\n puts \"page\"\n page.each do |step|\n puts \"step\"\n puts step\n puts \"step\"\n begin\n case step\n when \"Product\", \"Brandpseudo\"\n select_product\n when \"Kit\"\n select_kit\n when \"Gift\"\n select_gift\n when \"Supply\"\n select_supply\n when \"Fragrance\"\n select_fragrance\n when \"Shade\"\n select_shade\n when \"Formula\"\n select_formula\n when \"Pack\"\n select_pack\n when \"Duo\"\n select_duo\n end \n rescue => e\n e.display\n end\n end #of step execution\n end #of sas module selection \n # click_if_exists(:css, '#checkout.marketing-button-next')\n rescue => e\n e.display\n # TODO handle other situations\n end\n\n page = T5::Cart.new(@campaign_configuration)\n page.browser = @browser\n return page.adapt\n end",
"def set_elements\n super\n # Requisition Detail Area\n element(:license_request_checkbox) {b.checkbox(:id => \"document.licensingRequirementIndicator\")}\n element(:receiving_required_checkbox) {b.checkbox(:id => \"document.receivingDocumentRequiredIndicator\")}\n element(:payment_request_approval_required_checkbox) {b.checkbox(:id => \"document.paymentRequestPositiveApprovalIndicator\")}\n # Additional Institutional Info Tab\n element(:additional_info_tab_toggle) {b.input(:id => \"tab-AdditionalInstitutionalInfo-imageToggle\")}\n element(:additional_info_phone_number_field) {b.text_field(:id => \"document.requestorPersonPhoneNumber\")}\n # Delivery Tab\n element(:room_field) {b.text_field(:id => \"document.deliveryBuildingRoomNumber\")}\n element(:building_search_icon) {b.input(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[1]/input[1]\")}\n element(:campus_search_icon) {b.input(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[1]/input[1]\")}\n element(:delivery_phone_number_field) {b.text_field(:id => \"document.deliveryToPhoneNumber\")}\n # Vendor Tab\n element(:vendor_name_field) {b.text_field(:id => \"document.vendorName\")}\n element(:vendor_alias_field) {b.text_field(:id => 'document.vendorAliasName')}\n element(:select_vendor_button) {b.input(:alt => 'select vendor')}\n element(:vendor_search_icon) {b.input(:xpath => \"//input[@id='document.vendorName']/following-sibling::input[1]\")}\n # Titles Tab\n element(:grand_total_field) {b.b(:xpath => \"//div[@id='tab-Titles-div']/descendant::th[div[contains(text(),'Grand Total')]]/following-sibling::td/div/b\")}\n end",
"def supports_saved_payment_source\n true\n end",
"def add_payment_details(post, amount, payment, options)\n txn = {\n 'donationAmt': amount(amount),\n 'recurrpay': empty?(options[:recurrfreq]) ? 'N' : 'Y',\n 'recurrfreq': options[:recurrfreq],\n 'othamt4': options[:othamt4]\n }\n payment_details =\n if payment.respond_to?(:routing_number)\n { 'paymenttype': options[:payment_type].presence || 'ACH' }\n else\n options = {\n 'paymenttype': CARD_BRAND[payment.brand.to_sym],\n 'ccnumber': payment.number,\n 'ccexpire':\n \"#{format(payment.month, :two_digits)}#{format(payment.year, :two_digits)}\"\n }\n if payment.verification_value\n options['ccvv'] = payment.verification_value\n end\n options\n end\n\n # if we are processing a creditcard payment, we need to insert\n # the cardholder name in the supporter hash\n unless payment.respond_to?(:routing_number)\n post['supporter'].merge!('Credit Card Holder Name': payment.name)\n end\n post['transaction'] =\n txn.merge(payment_details).delete_if { |_, v| v.blank? }\n end",
"def new_input_set()\n return AcceptPayPalPaymentInputSet.new()\n end",
"def get_confirmed_payments(options_hash = {})\n query_info = options_hash[:query_info].nil? ? nil : options_hash[:query_info]\n # form can be... :technical_payments, :confirmed_payments\n form = options_hash[:form].nil? ? :confirmed_payments : options_hash[:form]\n \n return self.bitcoin_payments.map{|x| x.value}.sum if we_looked_up_blockchain_info_recently?\n \n \n checkout_wallet_info, latest_block = query_blockchain_for_new_payments_to_checkout_wallet(self.checkout_wallet.input_address, query_info)\n self.checkout_wallet.update_attributes(:last_successful_manual_lookup => Time.zone.now)\n self.checkout_wallet.calculate_if_payment_complete\n \n if checkout_wallet_info.nil?\n Message.emergency(\"a query_blockchain_for_new_payments_to_checkout_wallet returned a nil checkout_wallet_info somehow\", \n \"#{__FILE__}:#{__LINE__} \\n input_address#{self.checkout_wallet.input_address}\")\n return self.bitcoin_payments.map{|x| x.value}.sum\n end\n \n \n \n \n latest_height = latest_block['height']\n txs = checkout_wallet_info['txs']\n \n \n case form\n when :confirmed_payments\n correct_destination_values = self.bitcoin_payments.map{|x| x.value}.sum\n correct_destination_values += check_txs_for_unrecorded_properly_destined_values(txs, latest_height)\n when :technical_payments\n correct_destination_values = self.technical_bitcoin_payments.map{|x| x.value}.sum\n correct_destination_values += check_txs_just_to_see_that_payments_came_into_them(txs, latest_height)\n end\n \n correct_destination_values\n end",
"def shipping_charges_payment\n {'PaymentType' => payment_type,\n 'Payor' => {'AccountNumber' => @model.payor_account_number},\n :order! => ['PaymentType', 'Payor']}\n end",
"def get_currency_input_field_elements\n elements(xpath: './/label[contains(text(),\"Limit\") or contains(text(), \"Accounts Receivable\") or contains(text(), \"On Premises\") or contains(text(), \"Off Premises\")]//following-sibling::app-currency-input/input[1]')\n end",
"def payment_methods\n @credit_cards +\n @paypal_accounts +\n @apple_pay_cards +\n @google_pay_cards +\n @venmo_accounts +\n @us_bank_accounts +\n @visa_checkout_cards +\n @samsung_pay_cards +\n @sepa_direct_debit_accounts\n end",
"def prepare_gateway\n ActiveMerchant::Billing::Base.mode = gateway_mode\n begin\n @gateway = ActiveMerchant::Billing.const_get(\"#{gateway_name}Gateway\").new(gateway_credentials)\n @result[:gateway] = true\n end\n @result[:gateway]\n end",
"def set_elements\n super\n element(:po_number) {b.span(:id => \"process_item_po_doc_line#{line_id}_control\")}\n element(:po_end_date) {b.text_field(:id => \"invoice-poEndDate_line#{line_id}_control\")}\n element(:close_po_checkbox) {b.checkbox(:id => \"CurrentItem_closePO_line#{line_id}_control\")}\n element(:delete_po_button) {b.button(:id => \"CurrentItem_deletePurchaseOrder_line#{line_id}\")}\n element(:requisitions_toggle) {b.a(:id => \"po-requisition-view_line#{line_id}_toggle\")}\n element(:purchase_orders_toggle) {b.a(:id => \"po-po-view_line#{line_id}_toggle\")}\n element(:line_item_receiving_toggle) {b.a(:id => \"po-relatedReceiving-view_line#{line_id}_toggle\")}\n element(:correction_receiving_toggle) {b.a(:id => \"po-relatedCorrectionReceiving-view_line#{line_id}_toggle\")}\n element(:payment_requests_toggle) {b.a(:id => \"po-relatedPayment-view_line#{line_id}_toggle\")}\n element(:credit_memos_toggle) {b.a(:id => \"po-relatedCreditMemo-view_line#{line_id}_toggle\")}\n element(:add_button) {b.button(:id => \"addPOItems_button_test_line#{line_id}\")}\n end",
"def set_code_and_price_group()\n\t\t@foreign_postal_code = '123456789' #Default value for now as it is not validated and has no postage impact.\n\t\tif @mail_class == 'PG'\n\t\t\tinfo = {'CA' => 'Price Group 1', 'MX' => 'Price Group 2', 'HK' => 'Price Group 3', 'AL' => 'Price Group 4', 'FI' => 'Price Group 5', 'IN' => 'Price Group 6', 'DO' => 'Price Group 7', 'PE' => 'Price Group 8'}\n\t\t\ttemp = info.keys\n\t\t\t@destination_country_code = temp[rand(temp.size)]\n\t\t\t@customer_reference_number_1 = info[@destination_country_code]\n\t\telse\n\t\t\tinfo = {'CA' => 'Price Group 1', 'MX' => 'Price Group 2', 'HK' => 'Price Group 3', 'AL' => 'Price Group 4', 'FI' => 'Price Group 5', 'IN' => 'Price Group 6', 'CM' => 'Price Group 7', 'EG' => 'Price Group 8', 'JM' => 'Price Group 9'}\n\t\t\ttemp = info.keys\n\t\t\t@destination_country_code = temp[rand(temp.size)]\n\t\t\t@customer_reference_number_1 = info[@destination_country_code]\n\t\tend\n\tend",
"def test_rejected_cc_simulation\r\n @u = users(:user_without_sps_gateway_settting)\r\n @user = watir_session.with(:user_without_sps_gateway_settting)\r\n @user.logs_in\r\n \r\n \r\n b = @user.b\r\n @invoice = invoices(:invoice_moneris_payment_cc_two)\r\n add_sps_cc_profile(:user_without_sps_gateway_settting)\r\n @url = send_invoice(@invoice.id, true, true, true)\r\n \r\n total = b.span(:id, \"invoice_total\").text\r\n assert_equal \"1.50 CAD\", total\r\n\r\n link = b.link(:text, \"Pay Invoice\")\r\n link.click\r\n b.wait\r\n \r\n b.button(:value, \"Pay Now\").click\r\n\r\n\r\n b.text_field(:id, 'card_number').value=('4242424242424242')\r\n b.text_field(:id, 'card_first_name').value=('Payer First')\r\n b.text_field(:id, 'card_last_name').value=('Payer Last')\r\n b.select_list(:id, 'card_year').option(:text, '2012').select\r\n b.text_field(:id, 'card_verification_value').value=('123')\r\n \r\n\r\n b.text_field(:id, 'billing_address_name').value=('Payer Name')\r\n b.text_field(:id, 'billing_address_address1').value=('Payer Address1')\r\n b.text_field(:id, 'billing_address_city').value=('Payer City')\r\n b.select_list(:id, 'billing_address_state').select('BC - British Columbia')\r\n b.text_field(:id, 'billing_address_zip').value=('12345')\r\n b.text_field(:id, 'billing_address_phone').value=('123-456-7890')\r\n b.text_field(:id, 'billing_address_email').value=('[email protected]')\r\n\r\n b.button(:value, \"Pay Now\").click\r\n b.wait\r\n assert b.html.include?(\"Declined\")\r\n pay = Payment.find(:first, :conditions => {:pay_type => 'moneris' })\r\n assert_equal 'error', pay.status\r\n \r\n @user.goto(@url)\r\n b.wait\r\n sleep 3\r\n #verify pay invoice link does not exist\r\n\r\n inv = Invoice.find(@invoice.id)\r\n assert_equal \"sent\", inv.status\r\n assert_equal \"1.5\", inv.owing_amount.to_s\r\n assert_equal 0, inv.paid_amount\r\n \r\n \r\n @u = nil\r\n @user.teardown \r\n end",
"def test_success_cc_payment_page\r\n @u = users(:user_without_sps_gateway_settting)\r\n @user = watir_session.with(:user_without_sps_gateway_settting)\r\n @user.logs_in\r\n\r\n @invoice = invoices(:invoice_moneris_payment_cc)\r\n \r\n \r\n b = @user.b\r\n add_sps_cc_profile(:user_without_sps_gateway_settting)\r\n @url = send_invoice(@invoice.id, true, true, true)\r\n \r\n total = b.span(:id, \"invoice_total\").text\r\n assert_equal \"10.00 CAD\", total\r\n\r\n link = b.link(:text, \"Pay Invoice\")\r\n link.click\r\n b.wait\r\n \r\n b.button(:value, \"Pay Now\").click\r\n b.wait\r\n assert b.html.include?(\"12 errors\"), \"cannot find validation error message\"\r\n \r\n pay = Payment.find(:first, :conditions => {:pay_type => 'moneris' })\r\n assert_equal 'created', pay.status\r\n\r\n b.text_field(:id, 'card_number').value=('4242424242424242')\r\n b.text_field(:id, 'card_first_name').value=('Payer First')\r\n b.text_field(:id, 'card_last_name').value=('Payer Last')\r\n b.select_list(:id, 'card_year').option(:text, '2012').select\r\n b.text_field(:id, 'card_verification_value').value=('123')\r\n \r\n\r\n b.text_field(:id, 'billing_address_name').value=('Payer Name')\r\n b.text_field(:id, 'billing_address_address1').value=('Payer Address1')\r\n b.text_field(:id, 'billing_address_city').value=('Payer City')\r\n b.select_list(:id, 'billing_address_state').select('BC - British Columbia')\r\n b.text_field(:id, 'billing_address_zip').value=('12345')\r\n b.text_field(:id, 'billing_address_phone').value=('123-456-7890')\r\n b.text_field(:id, 'billing_address_email').value=('[email protected]')\r\n \r\n b.button(:value, \"Pay Now\").click\r\n b.wait\r\n assert b.html.include?(\"successfully recorded\")\r\n pay = Payment.find(:first, :conditions => {:pay_type => 'moneris' })\r\n assert_equal 'cleared', pay.status\r\n \r\n @user.goto(@url)\r\n b.wait\r\n sleep 3\r\n #verify pay invoice link does not exist\r\n assert !b.html.include?(\"Pay Invoice\") , \"Paid invoice link found for fully paid invoice.\"\r\n inv = Invoice.find(@invoice.id)\r\n assert_equal \"paid\", inv.status\r\n assert_equal 0.0, inv.owing_amount\r\n assert_equal inv.total_amount, inv.paid_amount\r\n \r\n \r\n @u = nil\r\n @user.teardown \r\n end",
"def assert_provider_payment_details # rubocop:disable Metrics/AbcSize\n within('.pf-c-page__main') do\n within('section', text: 'Personal Details') do\n find('dt', text: 'First Name').assert_sibling('dd', text: billing_address_example_data[:first_name])\n find('dt', text: 'Last Name').assert_sibling('dd', text: billing_address_example_data[:last_name])\n find('dt', text: 'Phone').assert_sibling('dd', text: billing_address_example_data[:phone])\n end\n\n within('section', text: 'Credit Card Details') do\n find('dt', text: 'Credit card number').assert_sibling('dd', text: \"XXXX-XXXX-XXXX-#{credit_card_example_data[:partial_number]}\")\n find('dt', text: 'Expiration date').assert_sibling('dd', text: buyer_credit_card_expiration_date.strftime('%B %Y'))\n end\n\n within('section', text: 'Billing Address') do\n find('dt', text: 'Company').assert_sibling('dd', text: billing_address_example_data[:company])\n find('dt', text: 'Address').assert_sibling('dd', text: billing_address_example_data[:street_address])\n find('dt', text: 'Zip').assert_sibling('dd', text: billing_address_example_data[:postal_code])\n find('dt', text: 'City').assert_sibling('dd', text: billing_address_example_data[:locality])\n find('dt', text: 'State').assert_sibling('dd', text: billing_address_example_data[:region])\n find('dt', text: 'Country').assert_sibling('dd', text: billing_address_example_data[:country_name])\n end\n end\nend",
"def set_policy_payment\n @policy_payment = PolicyPayment.find(params[:id])\n end",
"def wallet_payment_sources\n user.wallet_payment_sources.to_a\n end",
"def update_payment_amount(gateway_options)\n order_number, payment_number = gateway_options[:order_id].split('-')\n order = Spree::Order.friendly.find order_number\n total = Spree::KomerciConfig.calculate_portion_value(order, gateway_options[:portions]) * gateway_options[:portions]\n\n if total > order.total\n Spree::Adjustment.create(adjustable: order,\n amount: (total - order.total),\n label: Spree.t(:komerci_adjustment_tax),\n eligible: true,\n order: order)\n order.updater.update\n\n payment = Spree::Payment.friendly.find payment_number\n payment.update_attributes(amount: order.total)\n\n end\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def paypal_shipping_and_handling_costs(order)\n {}\n end",
"def payment_gateway_server\n if defined?(::PAYMENT_GATEWAY)\n ::PAYMENT_GATEWAY\n else\n ActiveMerchant::Billing::Base.mode = (['production', 'staging'].include?(ENV['RAILS_ENV']) ? :production : :test)\n ActiveMerchant::Billing::AuthorizeNetGateway.new(\n :login => AUTH_NET_LOGIN, # global constants from environment file\n :password => AUTH_NET_TXN_KEY,\n :test => ['production', 'staging'].include?(ENV['RAILS_ENV'])\n )\n end\n end",
"def set_defaults\n [:labor_paid, :labor_retained, :material_paid, :material_retained].each do |sym|\n #self.send(\"#{sym.to_s}=\", self.markup.apply_to(self.payment.lines.includes(:component => :markups).where('markups.id = ?', self.markup_id).sum(sym)))\n self.send(\"#{sym.to_s}=\", 0)\n end\n self.set_sums\n end",
"def setup_payflow_express_checkout\n setup_payflow_gateway(:payflow_express_uk)\n # This would go in an action method for signing them into their account\n response = @@gateway.setup_purchase(\n @order.total_price_in_cents, # Also accepts Money objects\n :order_id => @order.id,\n :currency => @currency_code,\n :no_shipping => 1,\n :header_image => \"https://streamburst.tv/images/streamburst.tv_paypal_banner.jpg\",\n :return_url => url_for(:action => \"payflow_express_success\", :order_id => @order.id, :_session_id => session.session_id),\n :cancel_return_url => url_for(:action => \"payflow_express_cancel\", :order_id => @order.id, :_session_id => session.session_id),\n :description => \"Payment for Streamburst content\")\n info(response.inspect)\n if response.success?\n @payflow_express_button_url = @@gateway.redirect_url_for(response.params[\"token\"])\n debug(\"payflow_express_button_url #{@payflow_express_button_url}\")\n else\n error(\"Failed to verify Paypal's notification for order: #{(@order == nil ? -1 : @order.id)}\")\n notify_administrators(\"setup_payflow_express_checkout\", \"For user: #{session[:user_id]} and Order: #{(@order == nil ? -1 : @order.id)}\") \n end\n end",
"def build_request(options)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.ShipmentConfirmRequest {\n xml.Request {\n xml.RequestAction 'ShipConfirm'\n xml.RequestOption 'nonvalidate'\n }\n }\n xml.Shipment {\n xml.Shipper {\n xml.Name @ship_from[:name]\n xml.ShipperNumber UPS.shipper_number\n xml.Address {\n xml.AddressLine1 @ship_from[:address]\n xml.AddressLine2 @ship_from[:address2] if @ship_from[:address2]\n xml.City @ship_from[:city]\n xml.StateProvinceCode @ship_from[:state] if @ship_from[:state]\n xml.PostalCode @ship_from[:zip] if @ship_from[:zip]\n xml.CountryCode @ship_from[:country] || 'US'\n }\n }\n xml.ShipTo {\n xml.CompanyName @ship_to[:name]\n xml.Address {\n xml.AddressLine1 @ship_to[:address]\n xml.AddressLine2 @ship_to[:address2] if @ship_to[:address2]\n xml.City @ship_to[:city]\n xml.StateProvinceCode @ship_to[:state] if @ship_to[:state]\n xml.PostalCode @ship_to[:zip] if @ship_to[:zip]\n xml.PostalCode @ship_to[:country] || 'US'\n }\n }\n }\n xml.Service {\n xml.Code @shipment_type\n }\n xml.PaymentInformation {\n xml.Prepaid {\n xml.BillShipper {\n xml.type @payment_info[:credit_card]\n xml.type @payment_info[:card_number]\n xml.type @payment_info[:expiration_date]\n xml.type @payment_info[:security_code] if @payment_info[:security_code]\n }\n }\n }\n xml.Package {\n xml.PackagingType {\n xml.type @package_type\n }\n xml.Dimensions {\n xml.UnitOfMeasurement {\n @measurements[:unit]\n }\n xml.Length @measurements[:length]\n xml.Width @measurements[:width]\n xml.Height @measurements[:height]\n }\n\n xml.PackageWeight {\n xml.Weight @measurements[:weight]\n }\n }\n\n xml.LabelSpecification {\n xml.LabelPrintMethod \"GIF\"\n xml.HTTPUserAgent \"Mozilla/4.5\"\n xml.LabelImageFormat {\n xml.code \"GIF\"\n }\n }\n end\n end",
"def offer_set(offerTypes, session, mvuser, lp)\n\turl = \"https://staging.lcp.points.com/v1/offer-sets/\"\n\n\tuser = {}\n\n\tif mvuser.nil?\n\t\tuser = {\"loyaltyProgram\" => lp}\n\telse\n\t\tuser[\"memberValidation\"] = mvuser[\"links\"][\"self\"][\"href\"]\n\t\tuser[\"firstName\"] = mvuser[\"identifyingFactors\"][\"firstName\"]\n\t\tuser[\"lastName\"] = mvuser[\"identifyingFactors\"][\"lastName\"]\n\t\tuser[\"email\"] = mvuser[\"identifyingFactors\"][\"email\"]\n\t\tuser[\"memberId\"] = mvuser[\"identifyingFactors\"][\"memberId\"]\t\t\n\tend\n\n\tbody = {\"offerTypes\" => offerTypes, \"session\" => session, \"user\" => user}.to_json\n\n\trequest = {\"url\" => url, \"body\" => body}\t\nend",
"def set_payment\n @payment = @contract.payments.find(params[:id])\n end",
"def set_payment_request\n @payment_request = Payment_request.find(params[:id])\n end",
"def payment_options(options={})\n {}.merge(options)\n end",
"def set_payment\n @payment = Payment.find(params[:order_id])\n end",
"def default_wallet_payment_source=(wallet_payment_source)\n if wallet_payment_source && !find(wallet_payment_source.id)\n raise Unauthorized, \"wallet_payment_source #{wallet_payment_source.id} does not belong to wallet of user #{user.id}\"\n end\n\n # Do not update the payment source if the passed source is already default\n if default_wallet_payment_source == wallet_payment_source\n return\n end\n\n Spree::WalletPaymentSource.transaction do\n # Unset old default\n default_wallet_payment_source.try!(:update!, default: false)\n # Set new default\n wallet_payment_source.try!(:update!, default: true)\n end\n end",
"def set_amounts\n super\n self.paid_amount = 0\n payments.each do |payment|\n self.paid_amount += payment.amount\n end\n end",
"def provider_payment_gateway\n provider_account&.payment_gateway(sca: payment_detail.payment_method_id.present?)\n end",
"def set_payment_request\n @payment_request = PaymentRequest.find(params[:id])\n end",
"def payment_gateway\n return Spree::BogusGateway.new if ENV['RAILS_ENV'] == \"development\" and Spree::Gateway::Config[:use_bogus]\n\n # retrieve gateway configuration from the database\n gateway_config = GatewayConfiguration.find :first\n config_options = {}\n gateway_config.gateway_option_values.each do |option_value|\n key = option_value.gateway_option.name.to_sym\n config_options[key] = option_value.value\n end\n gateway = gateway_config.gateway.clazz.constantize.new(config_options)\n\n return gateway\n end",
"def before_payment\n if try_spree_current_user && try_spree_current_user.respond_to?(:payment_sources)\n @payment_sources = try_spree_current_user.payment_sources\n end\n end",
"def set_billing_site\r\n @billing_site = BillingSite.find(params[:id])\r\n end",
"def set_usr_buyer_payment_method\n @usr_buyer_payment_method = UsrBuyerPaymentMethod.find(params[:id])\n end",
"def card_options(payment)\n options = options_for_select(Payment::card_brands.map {|k, v| [k.humanize, card_values(k)] }, payment.card_brand)\n \"<option disabled=\\\"disabled\\\"#{ 'selected=\"selected\"' unless payment.card_brand}>-- Choose --</option>\".html_safe + options\n end",
"def payment_gateway_params\n params.require(:payment_gateway).permit(:name,:site_id,:mode,:gateway_type,:config)\n end",
"def set_merchant\n @epsadmin_merchant = Merchant.where(:merchant_uniq_id => params[:merchant_uniq_id]).first\n end",
"def service_payment_info_loop\n end",
"def copy_billing_address\n @fields.select { |k, _| k.start_with? 'HPP_BILLING_' }\n .each do |k, v|\n add_field(\"HPP_SHIPPING_#{k.split('HPP_BILLING_')[1]}\", v)\n end\n end",
"def purchase(amount, source, gateway_options)\n if gateway_options[:portions].nil?\n return ActiveMerchant::Billing::Response.new(false, Spree.t('cielo.messages.invalid_portions'), {}, {})\n end\n\n total_value = update_payment_amount amount, source, gateway_options\n total_value.delete!('.')\n default_params = {\n parcelas: gateway_options[:portions],\n capturar: 'true'\n }\n\n if source.gateway_customer_profile_id.present?\n params = {token: CGI.escape(source.gateway_customer_profile_id)}\n elsif Spree::CieloConfig.generate_token\n params = generate_token source\n\n if params[:token].nil?\n params = {\n cartao_numero: source.number,\n cartao_validade: \"#{source.year}#{source.month}\",\n cartao_seguranca: source.verification_value,\n cartao_portador: source.name\n }\n end\n else\n params = {\n cartao_numero: source.number,\n cartao_validade: \"#{source.year}#{source.month}\",\n cartao_seguranca: source.verification_value,\n cartao_portador: source.name\n }\n end\n transaction_params = mount_params(total_value, source, params.merge!(default_params))\n\n transaction = Cielo::Transaction.new\n ret = transaction.create!(transaction_params, :store)\n\n if ret[:transacao][:status] == '6'\n ActiveMerchant::Billing::Response.new(true, Spree.t('cielo.messages.purchase_success'), {}, authorization: ret[:transacao][:tid])\n else\n ActiveMerchant::Billing::Response.new(false, Spree.t('cielo.messages.purchase_fail'), {}, authorization: ret[:transacao][:tid])\n end\n rescue\n verify_error 'purchase', ret\n end"
] | [
"0.6088275",
"0.6040698",
"0.5840004",
"0.57415533",
"0.5605391",
"0.5583048",
"0.5579271",
"0.5543433",
"0.5529068",
"0.5448396",
"0.5434311",
"0.5377675",
"0.5374703",
"0.5373312",
"0.5359347",
"0.5336463",
"0.5312228",
"0.53047246",
"0.53000236",
"0.5298056",
"0.5296034",
"0.52890646",
"0.5281833",
"0.52782667",
"0.52393013",
"0.52339804",
"0.51660705",
"0.516329",
"0.5151162",
"0.5138431",
"0.513611",
"0.5134375",
"0.5119014",
"0.51043844",
"0.51042366",
"0.5098531",
"0.5093805",
"0.5075996",
"0.5065963",
"0.5057329",
"0.5054977",
"0.5054649",
"0.5049573",
"0.50492847",
"0.5047749",
"0.5034978",
"0.5033458",
"0.50325197",
"0.503012",
"0.5025548",
"0.50243574",
"0.50205845",
"0.5007397",
"0.500581",
"0.49973226",
"0.4996853",
"0.4993965",
"0.49923283",
"0.49897972",
"0.49883482",
"0.4985918",
"0.4960104",
"0.49551713",
"0.49470255",
"0.49457958",
"0.4945707",
"0.49438697",
"0.49387017",
"0.49239832",
"0.49232543",
"0.4909275",
"0.4899573",
"0.4896176",
"0.48906374",
"0.48903862",
"0.4889559",
"0.4889559",
"0.48784775",
"0.48760986",
"0.48722667",
"0.48693052",
"0.4862822",
"0.48508573",
"0.4850272",
"0.48465875",
"0.48435748",
"0.48401493",
"0.48357183",
"0.48355678",
"0.48315817",
"0.48306838",
"0.48266354",
"0.48235652",
"0.48212016",
"0.48202702",
"0.48191315",
"0.48168555",
"0.4809715",
"0.48060736",
"0.48023435",
"0.48013395"
] | 0.0 | -1 |
Default nil value for context only for backward compatibility (Kill Bill 0.14.0) | def before_gateways(kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n nil\n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def null_context\n CoderContext.new\n end",
"def alter_context(context = T.unsafe(nil)); end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context=(value); end",
"def context_pin; end",
"def switch_to_default_context\n set_context nil\n end",
"def switch_to_default_context\n set_context nil\n end",
"def context\n self.current_custom_context || self.default_context\n end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def _prepare_context; end",
"def context\n @context ||= Context.new(self)\n end",
"def run_context\n nil\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context\n\n self\n end",
"def context\n init\n @context\n end",
"def get_context\n @context_hash ||= {}\n end",
"def context_methods; end",
"def context\n @context ||= Context.new(self)\n end",
"def is_null()\n res = super(context,self)\n return res\n end",
"def use_default_context(req, action)\n req.options.context ||= {}\n req.options.context.merge!(client: self.class,\n action: action,\n request_id: SecureRandom.hex(3))\n end",
"def context\n Context.instance\n end",
"def simple_context\n context_director.simple_context\n end",
"def default_context\n @@default_context = Graph.new(:identifier => @store.identifier, :store => @store)\n end",
"def graphiti_context\n if respond_to?(:jsonapi_context)\n DEPRECATOR.deprecation_warning(\"Overriding jsonapi_context\", \"Override #graphiti_context instead\")\n jsonapi_context\n else\n self\n end\n end",
"def main_context\n @main_context ||= Context.new\n end",
"def reset_context\n @context = nil\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def context(args)\n context = args.delete(:context)\n context || @my\n end",
"def __bb_context; end",
"def this_context\n self\n end",
"def context\n Thread.current[NAME] ||= Hash.new\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def last_context=(_arg0); end",
"def context\n @context || (parent.context if parent)\n end",
"def context_missing=(v)\n context.context_missing = v\n end",
"def initialize(context = nil)\n @context = context\n super\n end",
"def initialize\n self.context = Context.new\n end",
"def describe_context(context)\n @current_context = context\n end",
"def wants_context\n !(\n options.has_key?(:use_context) &&\n options[:use_context] == false\n )\n end",
"def context\n attributes.fetch(:context)\n end",
"def initialize(context)\n @context = context\n end",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end",
"def context=(ctx)\n @context = ctx\n end",
"def default_url_context\n {}\n end",
"def context_scope\n defined?(@_scope) ? @_scope : nil\n end",
"def context; { user: current_user } end",
"def initialize(opts = {})\r\n @context = opts[:context] || 3\r\n end",
"def last_context; end",
"def context\n @context ||= {name: name, record: record}\n end",
"def context\n Thread.current[NAME] ||= Array.new\n end",
"def context\n Byebug.current_context\n end",
"def context\n Zuul::Context.new context_type, context_id\n end",
"def in_context(context); end",
"def context=(ctx)\n @context.local = ctx\n end",
"def reset_define_context(context=nil)\n ret = @define_context\n @define_context = HashStruct.new(context || {})\n return ret\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end",
"def current_resource\n nil\n end",
"def context_methods\n super + [:context]\n end",
"def lookup_context=(_arg0); end",
"def fetch_context\n val = session.delete(:context)\n @context = val && val.to_sym\n true # TODO: remove in Rails 5.0\n end"
] | [
"0.76814955",
"0.724568",
"0.724568",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.69723195",
"0.6888651",
"0.685079",
"0.685079",
"0.67350477",
"0.67267084",
"0.67108095",
"0.67108095",
"0.6697834",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.6536626",
"0.65265596",
"0.65050334",
"0.6386974",
"0.6386974",
"0.6384953",
"0.6373231",
"0.6367092",
"0.6340019",
"0.62893695",
"0.62312335",
"0.6227834",
"0.62121874",
"0.6180541",
"0.615959",
"0.6147688",
"0.61444765",
"0.6142291",
"0.61313504",
"0.61313504",
"0.61294055",
"0.61294055",
"0.61294055",
"0.6097474",
"0.6090555",
"0.6083422",
"0.6079409",
"0.6078024",
"0.6077037",
"0.6055177",
"0.6052444",
"0.60496247",
"0.60359895",
"0.6021828",
"0.6014365",
"0.6009182",
"0.60072863",
"0.6001644",
"0.5993962",
"0.5988893",
"0.5972612",
"0.5970543",
"0.5969337",
"0.5957051",
"0.5946222",
"0.5933375",
"0.59274465",
"0.58947307",
"0.58764696",
"0.58725506",
"0.58568263",
"0.5856322",
"0.5846864",
"0.58265805",
"0.58250856",
"0.58220005",
"0.5812766"
] | 0.0 | -1 |
Default nil value for context only for backward compatibility (Kill Bill 0.14.0) | def after_gateways(response, transaction, gw_response, context = nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n nil\n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def null_context\n CoderContext.new\n end",
"def alter_context(context = T.unsafe(nil)); end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context=(value); end",
"def context_pin; end",
"def switch_to_default_context\n set_context nil\n end",
"def switch_to_default_context\n set_context nil\n end",
"def context\n self.current_custom_context || self.default_context\n end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def _prepare_context; end",
"def context\n @context ||= Context.new(self)\n end",
"def run_context\n nil\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context\n\n self\n end",
"def context\n init\n @context\n end",
"def get_context\n @context_hash ||= {}\n end",
"def context_methods; end",
"def context\n @context ||= Context.new(self)\n end",
"def is_null()\n res = super(context,self)\n return res\n end",
"def use_default_context(req, action)\n req.options.context ||= {}\n req.options.context.merge!(client: self.class,\n action: action,\n request_id: SecureRandom.hex(3))\n end",
"def context\n Context.instance\n end",
"def simple_context\n context_director.simple_context\n end",
"def default_context\n @@default_context = Graph.new(:identifier => @store.identifier, :store => @store)\n end",
"def graphiti_context\n if respond_to?(:jsonapi_context)\n DEPRECATOR.deprecation_warning(\"Overriding jsonapi_context\", \"Override #graphiti_context instead\")\n jsonapi_context\n else\n self\n end\n end",
"def main_context\n @main_context ||= Context.new\n end",
"def reset_context\n @context = nil\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def context(args)\n context = args.delete(:context)\n context || @my\n end",
"def __bb_context; end",
"def this_context\n self\n end",
"def context\n Thread.current[NAME] ||= Hash.new\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def last_context=(_arg0); end",
"def context\n @context || (parent.context if parent)\n end",
"def context_missing=(v)\n context.context_missing = v\n end",
"def initialize(context = nil)\n @context = context\n super\n end",
"def initialize\n self.context = Context.new\n end",
"def describe_context(context)\n @current_context = context\n end",
"def wants_context\n !(\n options.has_key?(:use_context) &&\n options[:use_context] == false\n )\n end",
"def context\n attributes.fetch(:context)\n end",
"def initialize(context)\n @context = context\n end",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end",
"def context=(ctx)\n @context = ctx\n end",
"def default_url_context\n {}\n end",
"def context_scope\n defined?(@_scope) ? @_scope : nil\n end",
"def context; { user: current_user } end",
"def initialize(opts = {})\r\n @context = opts[:context] || 3\r\n end",
"def last_context; end",
"def context\n @context ||= {name: name, record: record}\n end",
"def context\n Thread.current[NAME] ||= Array.new\n end",
"def context\n Byebug.current_context\n end",
"def context\n Zuul::Context.new context_type, context_id\n end",
"def in_context(context); end",
"def context=(ctx)\n @context.local = ctx\n end",
"def reset_define_context(context=nil)\n ret = @define_context\n @define_context = HashStruct.new(context || {})\n return ret\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end",
"def current_resource\n nil\n end",
"def context_methods\n super + [:context]\n end",
"def lookup_context=(_arg0); end",
"def fetch_context\n val = session.delete(:context)\n @context = val && val.to_sym\n true # TODO: remove in Rails 5.0\n end"
] | [
"0.76803505",
"0.72448766",
"0.72448766",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.69728726",
"0.6888296",
"0.68499005",
"0.68499005",
"0.67349726",
"0.6726527",
"0.6710236",
"0.6710236",
"0.6697076",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.65359193",
"0.6525322",
"0.6503015",
"0.63875663",
"0.63875663",
"0.63843244",
"0.63719505",
"0.636588",
"0.6339525",
"0.6288449",
"0.6231403",
"0.6227417",
"0.6211063",
"0.61790603",
"0.61599344",
"0.6148396",
"0.6143302",
"0.61410093",
"0.6131339",
"0.6131339",
"0.6128839",
"0.6128839",
"0.6128839",
"0.6096535",
"0.6090259",
"0.60823655",
"0.6078413",
"0.6077131",
"0.6075749",
"0.6054157",
"0.60522413",
"0.60494304",
"0.6035463",
"0.6021224",
"0.6013689",
"0.60082173",
"0.6006592",
"0.6000306",
"0.5994103",
"0.59886706",
"0.5973035",
"0.59691954",
"0.5968603",
"0.5956585",
"0.59451437",
"0.59326375",
"0.59268636",
"0.589372",
"0.5875973",
"0.5871251",
"0.58564943",
"0.58554757",
"0.58467907",
"0.5825734",
"0.5824797",
"0.5821012",
"0.5811603"
] | 0.0 | -1 |
Default nil value for context only for backward compatibility (Kill Bill 0.14.0) | def before_gateway(gateway, kb_transaction, last_transaction, payment_source, amount_in_cents, currency, options, context = nil)
# Can be used to implement idempotency for example: lookup the payment in the gateway
# and pass options[:skip_gw] if the payment has already been through
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n nil\n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def null_context\n CoderContext.new\n end",
"def alter_context(context = T.unsafe(nil)); end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context=(value); end",
"def context_pin; end",
"def switch_to_default_context\n set_context nil\n end",
"def switch_to_default_context\n set_context nil\n end",
"def context\n self.current_custom_context || self.default_context\n end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def _prepare_context; end",
"def context\n @context ||= Context.new(self)\n end",
"def run_context\n nil\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context\n\n self\n end",
"def context\n init\n @context\n end",
"def get_context\n @context_hash ||= {}\n end",
"def context_methods; end",
"def context\n @context ||= Context.new(self)\n end",
"def is_null()\n res = super(context,self)\n return res\n end",
"def use_default_context(req, action)\n req.options.context ||= {}\n req.options.context.merge!(client: self.class,\n action: action,\n request_id: SecureRandom.hex(3))\n end",
"def context\n Context.instance\n end",
"def simple_context\n context_director.simple_context\n end",
"def default_context\n @@default_context = Graph.new(:identifier => @store.identifier, :store => @store)\n end",
"def graphiti_context\n if respond_to?(:jsonapi_context)\n DEPRECATOR.deprecation_warning(\"Overriding jsonapi_context\", \"Override #graphiti_context instead\")\n jsonapi_context\n else\n self\n end\n end",
"def main_context\n @main_context ||= Context.new\n end",
"def reset_context\n @context = nil\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def context(args)\n context = args.delete(:context)\n context || @my\n end",
"def __bb_context; end",
"def this_context\n self\n end",
"def context\n Thread.current[NAME] ||= Hash.new\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def last_context=(_arg0); end",
"def context\n @context || (parent.context if parent)\n end",
"def context_missing=(v)\n context.context_missing = v\n end",
"def initialize(context = nil)\n @context = context\n super\n end",
"def initialize\n self.context = Context.new\n end",
"def describe_context(context)\n @current_context = context\n end",
"def wants_context\n !(\n options.has_key?(:use_context) &&\n options[:use_context] == false\n )\n end",
"def context\n attributes.fetch(:context)\n end",
"def initialize(context)\n @context = context\n end",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end",
"def context=(ctx)\n @context = ctx\n end",
"def default_url_context\n {}\n end",
"def context_scope\n defined?(@_scope) ? @_scope : nil\n end",
"def context; { user: current_user } end",
"def initialize(opts = {})\r\n @context = opts[:context] || 3\r\n end",
"def last_context; end",
"def context\n @context ||= {name: name, record: record}\n end",
"def context\n Thread.current[NAME] ||= Array.new\n end",
"def context\n Byebug.current_context\n end",
"def context\n Zuul::Context.new context_type, context_id\n end",
"def in_context(context); end",
"def context=(ctx)\n @context.local = ctx\n end",
"def reset_define_context(context=nil)\n ret = @define_context\n @define_context = HashStruct.new(context || {})\n return ret\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end",
"def current_resource\n nil\n end",
"def context_methods\n super + [:context]\n end",
"def lookup_context=(_arg0); end",
"def fetch_context\n val = session.delete(:context)\n @context = val && val.to_sym\n true # TODO: remove in Rails 5.0\n end"
] | [
"0.76803505",
"0.72448766",
"0.72448766",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.70064795",
"0.69728726",
"0.6888296",
"0.68499005",
"0.68499005",
"0.67349726",
"0.6726527",
"0.6710236",
"0.6710236",
"0.6697076",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.6673634",
"0.65359193",
"0.6525322",
"0.6503015",
"0.63875663",
"0.63875663",
"0.63843244",
"0.63719505",
"0.636588",
"0.6339525",
"0.6288449",
"0.6231403",
"0.6227417",
"0.6211063",
"0.61790603",
"0.61599344",
"0.6148396",
"0.6143302",
"0.61410093",
"0.6131339",
"0.6131339",
"0.6128839",
"0.6128839",
"0.6128839",
"0.6096535",
"0.6090259",
"0.60823655",
"0.6078413",
"0.6077131",
"0.6075749",
"0.6054157",
"0.60522413",
"0.60494304",
"0.6035463",
"0.6021224",
"0.6013689",
"0.60082173",
"0.6006592",
"0.6000306",
"0.5994103",
"0.59886706",
"0.5973035",
"0.59691954",
"0.5968603",
"0.5956585",
"0.59451437",
"0.59326375",
"0.59268636",
"0.589372",
"0.5875973",
"0.5871251",
"0.58564943",
"0.58554757",
"0.58467907",
"0.5825734",
"0.5824797",
"0.5821012",
"0.5811603"
] | 0.0 | -1 |
Default nil value for context only for backward compatibility (Kill Bill 0.14.0) | def after_gateway(response, transaction, gw_response, context = nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n nil\n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def null_context\n CoderContext.new\n end",
"def alter_context(context = T.unsafe(nil)); end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context=(value); end",
"def context_pin; end",
"def switch_to_default_context\n set_context nil\n end",
"def switch_to_default_context\n set_context nil\n end",
"def context\n self.current_custom_context || self.default_context\n end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def _prepare_context; end",
"def context\n @context ||= Context.new(self)\n end",
"def run_context\n nil\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context=(context = null)\n @bridge.set_context(context)\n end",
"def context\n\n self\n end",
"def context\n init\n @context\n end",
"def get_context\n @context_hash ||= {}\n end",
"def context_methods; end",
"def context\n @context ||= Context.new(self)\n end",
"def is_null()\n res = super(context,self)\n return res\n end",
"def use_default_context(req, action)\n req.options.context ||= {}\n req.options.context.merge!(client: self.class,\n action: action,\n request_id: SecureRandom.hex(3))\n end",
"def context\n Context.instance\n end",
"def simple_context\n context_director.simple_context\n end",
"def default_context\n @@default_context = Graph.new(:identifier => @store.identifier, :store => @store)\n end",
"def graphiti_context\n if respond_to?(:jsonapi_context)\n DEPRECATOR.deprecation_warning(\"Overriding jsonapi_context\", \"Override #graphiti_context instead\")\n jsonapi_context\n else\n self\n end\n end",
"def main_context\n @main_context ||= Context.new\n end",
"def reset_context\n @context = nil\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def switch_to_default_context\n @bridge.switch_to_default_context\n end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def context(args)\n context = args.delete(:context)\n context || @my\n end",
"def __bb_context; end",
"def this_context\n self\n end",
"def context\n Thread.current[NAME] ||= Hash.new\n end",
"def initialize(context)\n super()\n self.context = context\n end",
"def last_context=(_arg0); end",
"def context\n @context || (parent.context if parent)\n end",
"def context_missing=(v)\n context.context_missing = v\n end",
"def initialize(context = nil)\n @context = context\n super\n end",
"def initialize\n self.context = Context.new\n end",
"def describe_context(context)\n @current_context = context\n end",
"def wants_context\n !(\n options.has_key?(:use_context) &&\n options[:use_context] == false\n )\n end",
"def context\n attributes.fetch(:context)\n end",
"def initialize(context)\n @context = context\n end",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end",
"def context=(ctx)\n @context = ctx\n end",
"def default_url_context\n {}\n end",
"def context_scope\n defined?(@_scope) ? @_scope : nil\n end",
"def context; { user: current_user } end",
"def initialize(opts = {})\r\n @context = opts[:context] || 3\r\n end",
"def last_context; end",
"def context\n @context ||= {name: name, record: record}\n end",
"def context\n Thread.current[NAME] ||= Array.new\n end",
"def context\n Byebug.current_context\n end",
"def context\n Zuul::Context.new context_type, context_id\n end",
"def in_context(context); end",
"def context=(ctx)\n @context.local = ctx\n end",
"def reset_define_context(context=nil)\n ret = @define_context\n @define_context = HashStruct.new(context || {})\n return ret\n end",
"def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end",
"def current_resource\n nil\n end",
"def context_methods\n super + [:context]\n end",
"def lookup_context=(_arg0); end",
"def fetch_context\n val = session.delete(:context)\n @context = val && val.to_sym\n true # TODO: remove in Rails 5.0\n end"
] | [
"0.76814955",
"0.724568",
"0.724568",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.700716",
"0.69723195",
"0.6888651",
"0.685079",
"0.685079",
"0.67350477",
"0.67267084",
"0.67108095",
"0.67108095",
"0.6697834",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.66749114",
"0.6536626",
"0.65265596",
"0.65050334",
"0.6386974",
"0.6386974",
"0.6384953",
"0.6373231",
"0.6367092",
"0.6340019",
"0.62893695",
"0.62312335",
"0.6227834",
"0.62121874",
"0.6180541",
"0.615959",
"0.6147688",
"0.61444765",
"0.6142291",
"0.61313504",
"0.61313504",
"0.61294055",
"0.61294055",
"0.61294055",
"0.6097474",
"0.6090555",
"0.6083422",
"0.6079409",
"0.6078024",
"0.6077037",
"0.6055177",
"0.6052444",
"0.60496247",
"0.60359895",
"0.6021828",
"0.6014365",
"0.6009182",
"0.60072863",
"0.6001644",
"0.5993962",
"0.5988893",
"0.5972612",
"0.5970543",
"0.5969337",
"0.5957051",
"0.5946222",
"0.5933375",
"0.59274465",
"0.58947307",
"0.58764696",
"0.58725506",
"0.58568263",
"0.5856322",
"0.5846864",
"0.58265805",
"0.58250856",
"0.58220005",
"0.5812766"
] | 0.0 | -1 |
set up for testing to load files for tests | def set_files(input = "./sample1.txt",output = './dest1.txt')
@input_file = input
@output_file = output
@extract = load_file(@input_file,PATTERNS)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_load(test_files); end",
"def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end",
"def setup\n Inspec::Plugin::V2::Loader.new.load_all\n end",
"def setup\n @gbif = Pathname.new(__FILE__).dirname.join('gbif_genbank_linker_test.gbif.txt')\n @genbank = Pathname.new(__FILE__).dirname.join('gbif_genbank_linker_test.genbank.txt')\n\n # the sample gbif test file above has these accessions:\n @gbif_accessions = %w(\n 80720161\n AY099992\n AY099996\n AY099996\n AY100002\n AY100003\n AY308770\n AY308771\n AY308771\n AY308773\n AY308778\n )\n\n # the example genbank file has these:\n @genbank_accessions = %w(\n AY099992\n AY099996\n AY308768\n AY308769\n AY308770\n AY308771\n AY308772\n AY308773\n )\n\n # tests that rely on the actual downloads will be skipped unless these are\n # manually supplied\n # TODO: add how we get this\n @gbif_all = Rails.root.join('test/data/pipeline/input/0147211-200613084148143.filtered.txt.expanded')\n end",
"def setup\n File.expand_path(File.dirname(__FILE__) + '/data/')\n end",
"def setup\n FileUtils.mkdir TEMP_SITE_PATH\n FileUtils.cp_r File.join(TEST_SITE_PATH, '.'), TEMP_SITE_PATH\n # FIXME: I don't like this; change it when we can handle multiple ruhohs\n Ruhoh::Utils.stub(:parse_yaml_file).and_return('theme' => 'twitter')\n Ruhoh::Paths.stub(:theme_is_valid?).and_return(true)\n Ruhoh::Manager.setup :source => TEMP_SITE_PATH\nend",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end",
"def testing_begin(files)\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\r\n end",
"def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup()\n create_directories\n end",
"def prepare_test_stand\n unless CONFIG_DIR.exist?\n puts \"Unable to rum specs - .ini not found. Put all your .ini files into #{CONFIG_DIR}!\"\n RSpec.wants_to_quit=true\n end\n\n FileUtils.rm_rf TMP_DIR\n FileUtils.cp_r SOURCE_DIR, TEST_DIR #TMP_DIR\nend",
"def setup\n switch_dir\n end",
"def initialize(files, options)\n @files = files\n\n Rails.application.load_tasks\n Rake::Task['db:test:load'].invoke\n\n if options.delete(:fixtures)\n if defined?(ActiveRecord::Base)\n ActiveSupport::TestCase.send :include, ActiveRecord::TestFixtures\n ActiveSupport::TestCase.fixture_path = \"#{Rails.root}/test/fixtures/\"\n ActiveSupport::TestCase.fixtures :all\n end\n end\n\n MiniTest::Unit.runner.options = options\n MiniTest::Unit.output = SilentUntilSyncStream.new(MiniTest::Unit.output)\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end",
"def setup()\n end",
"def load_setup\n setupFile = @properties[\"config/setup_file\"]\n return unless (setupFile and File.exist?(setupFile))\n file = File.new(setupFile)\n setup = file.read\n file.close\n instance_eval(setup)\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def start_tests(files)\n end",
"def setup\n make_config\n make_users_file\n end",
"def setup\n # runs before every test\n # wipe and recreate .test directory, switch pwd \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n Dir.mkdir('.test')\n Dir.chdir('.test')\n end",
"def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def includes_load_paths; end",
"def setup; end",
"def setup\n templates = ['default']\n templates << @opts[:testkitchen] if @opts[:testkitchen]\n\n templates.each { |type| create_file(type) }\n end",
"def setup\n unzip_file(\"test/resources/IncludesSinceTestRepository.zip\", \"test/resources\")\n end",
"def load_tests (prefix)\n\n dp = File.dirname(__FILE__)\n\n Dir.new(dp).entries.select { |e|\n e.match(/^#{prefix}\\_.*\\.rb$/)\n }.sort.each { |e|\n load(\"#{dp}/#{e}\")\n }\nend",
"def setup_files(config_generator)\n raise NotImplementedError\n end",
"def initialize\n #get a list of all folders, then get a list of all\n #test files for each folder\n @base_dir = __FILE__ + '../../../test/functional/'\n \n @func_areas = Hash.new\n test_dir = Dir.new(@base_dir)\n \n folders = test_dir.entries\n \n folders.each do |folder|\n \n if !File.basename(@base_dir + folder).index(\".\") \n if File.ftype(@base_dir + folder)== \"directory\"\n @func_areas[File.basename(folder)]= get_test_files_for_dir(folder)\n end\n end\n end\n end",
"def setup\n load_users\n end",
"def initialize_test_layout\n self.model_tests_dir = \"test/unit\"\n self.controller_tests_dir = \"test/functional\"\n self.view_tests_dir = \"test/views\"\n self.fixtures_dir = \"test/fixtures\"\n end",
"def load_setup( name )\n reader = create_fixture_reader( name ) ### \"virtual\" method - required by concrete class\n\n reader.each do |fixture_name|\n load( fixture_name )\n end\n end",
"def setup\n FileUtils.mkdir_p(data_path)\n end",
"def setup\n FileUtils.mkdir_p(data_path)\n end",
"def load()\n\n checkFileExists()\n loadConfigs()\n checkConfigs() \n end",
"def setup\n FileUtils.remove_dir(File.expand_path(TEST_DIR), true)\n @wd = WebDump.new :base_dir => TEST_DIR\n end",
"def setup\n @expand_path = File.expand_path(@infile)\n @basename = File.basename(@expand_path)\n @infile_ext = File.extname(@infile)\n file_ext_check\n true\n end",
"def setup\n # wipe and recreate .test directory \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n # NOTE: I don't think we want to kill .repository in pwd from running test\n if File.exist?('.repository')\n FileUtils.rm_rf('.repository')\n end\n Dir.mkdir('.test')\n Dir.chdir('.test')\n end",
"def setup\n # override this if needed\n end",
"def initialize(config, game)\n @config = config\n @game = game\n # Parse tests suites\n @tests_suites = Dir.glob(\"#{__dir__}/tests_suites/*.rb\").map do |tests_suite_file|\n tests_suite = File.basename(tests_suite_file, '.rb').to_sym\n require \"#{__dir__}/tests_suites/#{tests_suite}.rb\"\n [\n tests_suite,\n TestsSuites.const_get(tests_suite.to_s.split('_').collect(&:capitalize).join.to_sym).new(tests_suite, @game)\n ]\n end.to_h\n @tests_info_file = \"#{@game.path}/Data/Modsvaskr/Tests/TestsInfo.json\"\n end",
"def setup_file\n self.setup_path \n end",
"def setup\n preference_file = \"#{defaults[:root_dir]}/config.yml\"\n preferences = {}\n if File.exists? preference_file\n require 'yaml'\n File.open(preference_file) { |file| preferences = YAML.load(file) }\n end\n base_file_variations(absolute_paths(defaults.merge(preferences)))\n end",
"def setup_script_execution\n Dir.glob(File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__TestScript*')).should be_empty\n Dir.glob(File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '[0-9]*')).should be_empty\n InstanceConfiguration.const_set(:CACHE_PATH, File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, 'cache'))\n end",
"def setup_default_fixtures(files = ['sample_actors' , 'users', 'wiki_entries'])\n Fixtures.reset_cache\n files.each do |f|\n Fixtures.create_fixtures( File.dirname(__FILE__) + '/../fixtures' , File.basename( f , '.*'))\n end\nend",
"def setup_files\n create_application_rb\n create_production_rb\n end",
"def setup!\n Dir[\"#{Gruf.servers_path}/**/*.rb\"].each do |f|\n logger.info \"- Loading gRPC service file: #{f}\"\n require f\n end\n end"
] | [
"0.7965068",
"0.7254508",
"0.70111597",
"0.69642407",
"0.6937427",
"0.69242495",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.68819416",
"0.6862492",
"0.67951816",
"0.6793857",
"0.6793857",
"0.679243",
"0.679243",
"0.679243",
"0.679243",
"0.679243",
"0.679243",
"0.679243",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.678299",
"0.676744",
"0.6767165",
"0.6764466",
"0.6764466",
"0.6764466",
"0.6764466",
"0.6764466",
"0.6754139",
"0.6750185",
"0.6727625",
"0.6723757",
"0.66816145",
"0.66816145",
"0.66816145",
"0.66816145",
"0.66816145",
"0.66816145",
"0.6674023",
"0.66121286",
"0.6611981",
"0.66093874",
"0.66093874",
"0.66093874",
"0.6588956",
"0.65863043",
"0.65811616",
"0.6576574",
"0.6575988",
"0.6575988",
"0.65725714",
"0.656841",
"0.65593886",
"0.65475124",
"0.6539776",
"0.6525555",
"0.652142",
"0.6514251",
"0.6505681",
"0.6503166",
"0.64912355",
"0.64912355",
"0.64892375",
"0.6482351",
"0.6463549",
"0.64491343",
"0.64480495",
"0.6428628",
"0.642511",
"0.6385727",
"0.63813806",
"0.6375385",
"0.63536614",
"0.6340553"
] | 0.0 | -1 |
reads given data and converts it into hash/dictionary | def convert_to_hash(symbol,array_num,keys,conv)
result = {}
@extract[symbol][array_num].split(' ').each_with_index do |el,ix|
converted_el = el.send(conv[ix])
result[keys[ix]] = (converted_el == 'true' ||
converted_el == 'false')? eval(converted_el) : converted_el
#eval has to be performed on 'false'/'true'
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data stream=STDIN\n\tdata = {}\n\tstream.each do |line|\n\t\tline =~ /^([0-9]*)\\|(.*)/;\n\t\tid, name_addr = $1.to_i, $2\n\t\traise \"duplicate id #{id}?\" if data[id]\n\t\tdata[id] = name_addr\n\tend\n\tdata\nend",
"def parse_hash_packet(data)\n hashes = []\n\n algo = data.read_string\n size = case algo\n when \"md5\" then 128\n when \"sha256\" then 256\n when \"sha384\" then 284\n when \"sha512\" then 512\n else raise NotImplementedError, \"unsupported algorithm: #{algo}\"\n end\n\n while !data.eof? do\n hashes << data.read(size)\n end\n\n { :algo => algo, :hashes => hashes }\n end",
"def parse_hash\n \thash = {}\n \t# Remove the first five lines of the file\n \ttemp_array = @readin[5, @readin.length]\n \t# Split the input at the semicolon: the left hand side is a timestamp and the right hand side\n \t# is the value (either power in W, or energy in Wh depending on the file type).\n \t# This is committed to a hash with time as the key and the W/Wh as the value.\n \ttemp_array.each do |s|\n \t\tk,v = s.split(/;/)\n \t\t# the Aurora reports time as seconds since 1/1/0000 and Ruby reports time utilizing an epoch\n \t\t# that began on 1/1/1970. The time stamp is adjusted for the time in seconds between these\n \t\t# two dates.\n \t\thash[Time.at(k.to_i - 62167104000)] = v.to_f\n \tend\n \treturn hash\n end",
"def to_h\n read!\n @data.dup\n end",
"def hash\n @hash ||= opts[:parser].parse(data.to_s.gsub(/\\<!\\[CDATA\\[([^\\]]+)\\]\\]\\>/) {$1})\n end",
"def read_data(hash_len, data, sub)\n # returns an array of hashes of the form: { host, path, chunk }\n entry_list = []\n addchunknum = \"\"\n\n data = StringIO.new(data)\n while(hostkey = data.read(4))\n hostkey = hostkey.unpack(\"H*\")[0]\n count = data.read(1).unpack(\"H*\")[0].hex # or .to_i(16)\n if(sub)\n addchunknum = data.read(4).unpack(\"H*\")[0]\n end\n\n # If count > 1, it will be prefix-chunk until the last one, which will be just prefix\n count.times do |i|\n entry = {}\n entry['host'] = hostkey\n\n path_prefix = data.read(hash_len).unpack(\"H*\")[0]\n entry['path'] = path_prefix\n\n if(sub && count > 1 && i != count-1)\n entry['chunk'] = data.read(4).unpack(\"H*\")[0]\n else\n entry['chunk'] = addchunknum\n end\n\n entry_list.push(entry)\n end\n end\n\n return entry_list\n end",
"def read_data\n entities = Hash.new\n DATA.each_line.map(&:chomp).each do |entity|\n entities[entity.split(',').slice(0..-2).map { |n| n.to_i } ] = entity.split(',').slice(-1)\n end\n entities\nend",
"def data_hash\n @data_hash ||=\n case @data\n when String\n JSON.parse(@data)\n when Hash\n @data\n else\n {}\n end\n end",
"def to_hash\n data.to_hash\n end",
"def to_hash\n data.to_hash\n end",
"def parse(data)\n if !data.respond_to?(:read)\n data = StringIO.new(data || \"\")\n end\n\n if data.eof?\n {}\n else\n LibXML::XML::Parser.io(data).parse.to_hash\n end\n end",
"def a_string_to_hash\n self.remove_characters\n self.correct_formatting\n self.answer_split\n self.answer_join\n self.sort_answers\n self.arr_to_hash\n return self.data\n end",
"def readRaw\n puts \"Reading raw data..\"\n # data = {uid => {iid => [hour1, hour2, ...]}}}\n data = {}\n while line = $stdin.gets do\n uid, iid, hour = line.chomp.split(',').map {|e| e.to_i}\n data[uid] = {} unless data.key?(uid)\n data[uid][iid] = [] unless data[uid].key?(iid)\n data[uid][iid] += [hour]\n end\n data.each_pair do |u, ihs|\n ihs.each_key {|i| ihs[i].uniq.sort}\n end\n return data\nend",
"def parse(data)\n if !data.respond_to?(:read)\n data = StringIO.new(data || '')\n end\n\n char = data.getc\n if char.nil?\n {}\n else\n data.ungetc(char)\n LibXML::XML::Parser.io(data).parse.to_hash\n end\n end",
"def hash\n [ data, type ].hash\n end",
"def load_track_data(data)\n track = Hash.new\n key = nil\n data.children.each do |data|\n if data.name == 'key'\n key = data.text.downcase.gsub(/\\s/, '_').to_sym\n elsif data.name == 'integer'\n track[key] = data.text.to_i\n elsif data.name == 'string'\n track[key] = data.text\n end\n end\n track\n end",
"def to_h\n # TODO: Use a Mash -- some keys are better off addressed as strings\n JSON.parse(raw_data, symbolize_names: true)\n end",
"def load_data(data)\n data.symbolize_keys!\n\n @id = data[:id] || nil\n @name = data[:name]\n @color = data[:color]\n @indent = data[:indent]\n @item_order = data[:item_order]\n end",
"def data_hash\n @data_hash ||= begin\n\n return nil if data.blank?\n parsed = JSON.parse(data)\n return nil if parsed.blank?\n\n parsed.with_indifferent_access\n end\n end",
"def read_parsed_data(data)\n if data.is_a?(Array) && data.length == 2 && data[0] == \"proxyobj\"\n id = data[1].to_i\n\n if (proxy_obj = @objects_handler.find_by_id(id))\n $stderr.print \"Reuse proxy-obj!\\n\" if @debug\n return proxy_obj\n else\n return @objects_handler.spawn_by_id(id)\n end\n elsif data.is_a?(Hash)\n newdata = {}\n data.each do |key, val|\n newdata[key] = read_parsed_data(val)\n end\n\n return newdata\n else\n return data\n end\n end",
"def hash\n data.hash\n end",
"def map_input_data(hash)\n hash\n end",
"def build_existinghash(data)\n existinghash = {}\n data.each do |key, value|\n existinghash[key.to_s] = value.to_s.tr(\"\\n\", ' ').strip\n end\n existinghash\n end",
"def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end",
"def read_data(fname)\n ents=[]\n if ( File.exist?(fname) )\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5,a6 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1\n hash[\"2\"] = a2\n hash[\"3\"] = a3\n hash[\"4\"] = a4\n hash[\"5\"] = a5\n hash[\"6\"] = a6\n ents.push(hash)\n end\n end\n end\n ents\nend",
"def to_h\n raw_data.split(\"\\n\").each_with_object({}) do |line, hsh|\n key, val = line.split.entries\n key = key.to_sym\n val = true if val == 'true'\n val = false if val == 'false'\n hsh[key] = val\n key == :url && hsh.merge!(parse_url_data(val))\n end\n end",
"def prepare_data(data)\n d = {}\n data.each do |key, val|\n case key.to_s\n when /^<(.*?)>(.*)$/\n d[\"#{$1}#{$2}\"] = val\n when /^\\w/\n d[\"##{key}\"] = val\n else\n d[key.to_s] = val\n end\n end\n return d\n end",
"def my_hash_maker( the_data)\n the_split = the_data.split(\"\\n\")\n new_array = the_split.map { | the_character | the_character.split(\",\") }\n my_hash = new_array.map { | the_character | {:mentions => the_character[0].to_i, :name => the_character[1], :house => the_character[2]} }\nend",
"def parse( data )\n Hashie::Mash.new( \n Hash.from_xml( data ) )\n end",
"def restore\n unless @hash\n @hash = {}\n begin\n lockf = File.open(@path+\".lock\", \"r\")\n lockf.flock File::LOCK_SH\n f = File.open(@path, 'r')\n for line in f\n line.chomp!\n k, v = line.split('=',2)\n #@hash[CGI::unescape(k)] = Marshal.restore(CGI::unescape(v))\n # Just supports bools and strings\n valueString = CGI::unescape(v)\n type = valueString[0]\n if type == 'B'\n if valueString[1] == 'T'\n value = true\n else\n value = false\n end\n elsif type == 'S'\n value = valueString[1, valueString.length - 1]\n else\n value = nil\n end\n @hash[CGI::unescape(k)] = value\n end\n ensure\n f.close unless f.nil?\n lockf.close if lockf\n end\n end\n @hash\n end",
"def q_string_to_hash\n self.remove_characters\n self.question_split\n self.question_join\n self.sort_questions\n self.arr_to_hash\n return self.data\n end",
"def read_shadowhashdata(data)\n plist = CFPropertyList::List.new(:data => data[0].to_s)\n CFPropertyList.native_types(plist.value)\n end",
"def to_hash\n @data.to_hash\n end",
"def to_hash\n @data\n end",
"def data_object\n begin\n result = JSON.parse(T.must(data), symbolize_names: true)\n rescue StandardError\n result = {}\n end\n result\n end",
"def data_hash\n primary, included =\n resources_processor.process(Array(@data), @include, @fields)\n {}.tap do |hash|\n hash[:data] = @data.respond_to?(:to_ary) ? primary : primary[0]\n hash[:included] = included if included.any?\n end\n end",
"def data_hash\n @data_hash ||= Hashie::Mash.new(sanitize_data(self.data || {}).reverse_merge(built_in_variables))\n end",
"def unpack(data); end",
"def test_data_hash\n [{\n 'PB' => 'Honinbo Shusaku',\n 'BR' => '6d',\n 'PW' => 'Honinbo Shuwa',\n 'WR' => '8d',\n 'GC' => 'game from Hikaru no Go chapter 2, this version only in the anime',\n 'RE' => 'W+4'\n }]\n end",
"def file_to_hash( file )\n to_hash( File.read( file ) )\n end",
"def unmarshal(data)\n event = Hash.new { |hash, key| hash[key] = [] }\n\n data.split(\"\\n\").each do |line|\n key, value = line.split(/: ?/, 2)\n next if key =~ /^\\s*$/\n\n event[key.to_sym] << value\n end\n\n event.inject({}) do |hash, (key, value)|\n hash.update key => value.join(\"\\n\")\n end\n end",
"def read\n num_kv = @kinvars.length\n unpck = String.new\n num_kv.times{unpck += 'd'}\n vals = @file.read(num_kv*8).unpack(unpck)\n vals_hash = Hash.new\n num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]}\n vals_hash\n end",
"def read\n tryR(\"read\")\n hash = {}\n @db.each do |k, v|\n v or kyoto_error!(\"each(%s): \" % k)\n hash[k] = decode(v)\n end\n return hash\n end",
"def parse_data( text )\r\n\t\t# Sample line of text:\r\n\t\t# Kentucky:23,56,89\r\n\t\t# Will look like: { \"Kentucky\" => { \"R\" => 23, \"G\" => 56, \"B\" => 89 } }\r\n\t\tcolor_hash = {}\r\n\t\ttext.each{ |line|\r\n\t\t\tteam, colors = line.split( \":\" )\r\n\t\t\tr,g,b = colors.split( \",\" )\r\n\t\t\tcolor_hash[team] = { \"R\" => r, \"G\" => g, \"B\" => b }\r\n\t\t}\r\n\t\treturn color_hash\r\n\tend",
"def read\n return unless File.exist?(filename)\n\n name = DEFAULT_NAME\n save = Hash.new{ |h,k| h[k.to_s] = {} }\n\n File.read(filename).lines.each do |line|\n if md = /^\\[(\\w+)\\]$/.match(line)\n name = md[1]\n end\n if md = /^(\\w+)\\s+(.*?)$/.match(line)\n save[name][md[2]] = md[1]\n end\n end\n\n save.each do |name, digest|\n @saved[name] = digest\n end\n end",
"def parse_data_packet(packet)\n { :data => packet.read_string }\n end",
"def to_hash\n @data\n end",
"def parseData(result, type, data)\n if (type == \"crc\")\n if (data =~ /^0x(.*)$/)\n data = $1\n end\n elsif (type == \"docs\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid doc entry #{data}\"\n result[\"unique_docs\"] = $1.to_i\n result[\"meta_entries\"] = $2.to_i\n return\n elsif (type == \"bytes\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid bytes entry #{data}\"\n result[\"unique_docs_size\"] = $1.to_i\n result[\"utilized_file_size\"] = $2.to_i\n return\n elsif (type == \"trusted\" || type == \"active\" || type == \"ready\")\n result[type] = (data =~ /^true$/i ? true : false)\n return\n end\n result[type] = data\n end",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend",
"def parse_data(data)\n @ver = data.unpack(\"I\")[0]\n idx = 4\n in_size, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize-tmp.bytesize\n # raise \"unkown transaction version: #{@ver}\" unless @ver == 1\n\n @in = (0...in_size).map{\n txin = TxIn.new\n idx += txin.parse_data(data[idx..-1])\n txin\n }\n\n out_size, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize-tmp.bytesize\n\n @out = (0...out_size).map{\n txout = TxOut.new\n idx += txout.parse_data(data[idx..-1])\n txout\n }\n\n @lock_time = data[idx...idx+=4].unpack(\"I\")[0]\n\n @payload = data[0...idx]\n @hash = hash_from_payload(@payload)\n\n if data[idx] == nil\n true # reached the end.\n else\n data[idx..-1] # rest of buffer.\n end\n end",
"def to_hash\n # Get buffer contents as a String\n s = lock {buf} rescue ''\n # Split into RECORD_SIZE character lines\n lines = s.scan(/.{#{RECORD_SIZE}}/o)\n # Skip END record\n lines.pop if lines[-1].start_with?('END ')\n\n # Parse lines into key and value\n h = {}\n lines.each do |l|\n key, value = l.split('=', 2)\n value ||= '' # In case no '='\n key.strip!\n value.strip!\n # If value is enclosed in single quotes, remove them and strip spaces\n value = value[1..-2].strip if /^'.*'$/ =~ value\n h[key] = value\n end\n h\n end",
"def key_for(data)\n data.hash\n end",
"def read_data\n unpacker.read\n end",
"def data\n @data ||= Dir['data/*'].reduce({}) do |data, file|\n raw_data = File.read(file)\n filename = parse_filename(file)\n schema = schemas[filename]\n\n data[filename] = raw_data.split(\"\\n\").map do |row|\n schema.reduce({}) do |object, column|\n # slice from the beginning of the row the relevant number of\n # characters based on the column's attribute length\n raw_value = row.slice!(0, column[:length].to_i)\n\n parsed_value = parse_attribute(raw_value, column[:type])\n object[column[:name]] = parsed_value\n object\n end\n end\n end\n end",
"def parse_binary_data(binary_data)\n chunk_size = DATA_ELEMENTS + 1 # plus header\n data_elements = binary_data.length / DATA_FORMAT.length\n data_format = binary_format data_elements\n unpacked = binary_data.unpack(data_format)\n buffer = unpacked[HEADER_FORMAT.length..-1]\n data = {}\n data_elements.times do |element_index|\n offset = element_index * chunk_size\n chunk = buffer[offset..offset + chunk_size]\n element_id = chunk[0]\n map = Xplane::XPLANE_DATA_MAPPER[element_id]\n if map\n map.each_with_index do |key, i|\n data[key] = chunk[i + 1] # plus header\n end\n end\n end\n return data\n end",
"def extrst(data)\n io = StringIO.new(data)\n\n _, cb = io.read(4).unpack('vv')\n # reserved (2 bytes): MUST be 1, and MUST be ignored.\n result = { cb: cb } # cb (2 bytes): An unsigned integer that specifies the size, in bytes, of the phonetic string data.\n\n result[:phs] = phs(io.read(4)) # phs (4 bytes): A Phs that specifies the formatting information for the phonetic string.\n result[:rphssub] = rphssub(io) # rphssub (variable): An RPHSSub that specifies the phonetic string.\n\n result[:rphssub][:crun].times do # See 2.5.219 RPHSSub\n result[:rgphruns] ||= []\n result[:rgphruns] << rgphruns(io)\n end\n\n result\n end",
"def json\n @hash ||= ::JSON.parse(data)\n end",
"def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n line.tr!(\"\\u0000\",\"\")\n next if line == \"\\n\"\n next if line =~ /^\\=/\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp.upcase\n end\n end\n f.close\n return return_hash\nend",
"def to_hash()\n @data\n end",
"def to_hash(description='String::to_hash() made by genious RCarlesso (give a better description if u dont like this!)')\n arr = Hash.new\n arr['_meta'] = Hash.new\n arr['_meta']['description'] = description\n arr['_meta']['time'] = Time.now\n self.split(\"\\n\").each{|line| \n k,v = line.split(': ') \n arr[k.strip] = v.strip \n } rescue arr['_meta']['errors'] = $! \n arr\n end",
"def to_hash\n # TODO: find a better option to populate the data to the Hash\n image;feed;links;charset;absolute_links;title;meta_keywords\n @data.to_hash\n end",
"def load_data()\n puts \"Which file would you like to pull data from?\"\n\n IO.foreach($stdin.gets.chomp) do |l|\n ui, mi, r, ts = l.split\n user_id, movie_id, rating, timestamp = ui.to_i, mi.to_i, r.to_i, ts.to_i\n\n # mov_and_rat = movies_and_ratings\n # use_and_rat = users_and_ratings\n @data[:users].add(user_id)\n unless(@data[:user_id][user_id])\n @data[:user_id][user_id] = {\n mov_and_rat: { movie_id => rating },\n titles: [movie_id]\n }\n else\n @data[:user_id][user_id][:mov_and_rat][movie_id] = rating\n @data[:user_id][user_id][:titles].push(movie_id)\n end\n\n @data[:movies].add(movie_id)\n unless(@data[:movie_id][movie_id])\n @data[:movie_id][movie_id] = {\n use_and_rat: { user_id => rating },\n ratings: [rating]\n }\n else\n @data[:movie_id][movie_id][:use_and_rat][user_id] = rating\n @data[:movie_id][movie_id][:ratings].push(rating)\n end\n end\n end",
"def load_hashes(data_set)\n\t\tFile.open(data_set, \"r\") do |f|\n\t\t\tf.each_line do |line|\n\t\t\t\t@@line_array = line.split(' ')\n\t\t\t\tload_user_info\n\t\t\t\tload_movie_viewers\n\t\t\t\tload_movie_ratings\t\n\t\t\tend\n\t\tend\n\tend",
"def parse_user_data_str(user_data_str)\n user_data = {}\n line_no = 0\n user_data_str.each_line do |line|\n line_no += 1\n line = line.strip\n next if line =~ /^#/ # skip comments\n next if line.empty? # skip blank lines\n parts = line.split(\"=\")\n if parts.length < 2\n warn \"user-data line #{line_no} does not conform to specification: '#{line}'\"\n else\n key = parts.first\n value = parts[1..-1].join('=') # in case there was an '=' in the value\n # already have a value, so make sure we have an array\n if user_data[key]\n if !user_data[key].is_a?(Array)\n user_data[key] = [user_data[key]]\n end\n user_data[key] << value\n else\n user_data[key] = value\n end\n end\n end\n\n return user_data\n end",
"def header_to_hash data\n header = {}\n data = data.split(@opts[:delimiter])\n self.req[\"Verb\"], self.req[\"Url\"], self.req[\"Version\"] = data.shift.split(\" \", 3)\n data.each do |line|\n k,v = line.split(\":\", 2)\n if !@opts[:header_bl] || !(HEADER_BLACKLIST.include? k)\n header[k] = v.lstrip\n end\n end\n header\n end",
"def load_data (file, data, k=nil)\n\t\ti=0\n\t\tfile.each_line do |line|\n\t\t\tif i ==k \n\t\t\t\tbreak\n\t\t\tend\n\t\t\twords = line.split(\"\\t\")\n\t\t\tif data.has_key?(words[0].to_i)\n\t\t\t\tdata[words[0].to_i].store_data(words[1].to_i,words[2].to_i)\n\t\t\telse\n\t\t\t\tx = User_data.new\n\t\t\t\tx.store_data(words[1].to_i,words[2].to_i)\n\t\t\t\tdata.store(words[0].to_i, x)\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend",
"def parse_witness_data_from_io(data)\n buf = data.is_a?(String) ? StringIO.new(data) : data\n\n @ver = buf.read(4).unpack(\"V\").first\n\n @marker = buf.read(1).unpack(\"c\").first\n\n @flag = buf.read(1).unpack(\"c\").first\n\n in_size = Bitcoin::Protocol.unpack_var_int_from_io(buf)\n @in = []\n in_size.times{\n break if buf.eof?\n @in << Bitcoin::Protocol::TxIn.from_io(buf)\n }\n\n out_size = Bitcoin::Protocol.unpack_var_int_from_io(buf)\n @out = []\n out_size.times{\n break if buf.eof?\n @out << Bitcoin::Protocol::TxOut.from_io(buf)\n }\n\n @witness = Bitcoin::Protocol::TxWitness.new\n in_size.times{\n witness_count = Bitcoin::Protocol.unpack_var_int_from_io(buf)\n in_witness = Bitcoin::Protocol::TxInWitness.new\n witness_count.times{\n length = Bitcoin::Protocol.unpack_var_int_from_io(buf)\n in_witness.add_stack(buf.read(length).unpack(\"H*\").first)\n }\n @witness.add_witness(in_witness)\n }\n\n @lock_time = buf.read(4).unpack(\"V\").first\n\n @hash = hash_from_payload(to_payload)\n end",
"def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end",
"def initialize_input_hash(filename)\n input = {}\n File.open(filename, 'r') do |file|\n while line = file.gets\n input[line.to_i] = true\n end\n end\n input\nend",
"def decode data\n if data.is_a? Hash\n self.class.attributes.each do |name, options|\n send(\"#{name}=\", processed_data(data[name] || data[name.to_s], options))\n end\n elsif name = self.class.default_attribute\n options = self.class.attributes[name]\n send(\"#{name}=\", processed_data(data, options))\n else\n raise ArgumentError.new(\"data is not a Hash (it\\'s a #{data.class}) and default attribute not specified\")\n end\n end",
"def read_fixture_as_hash(name)\n JSON.parse(read_fixture(name))\nend",
"def to_hash\n @data\n end",
"def parse(data)\n returning({}) do |results|\n data.split('&').each do |pair|\n key, value = pair.split('=')\n results[key] = value\n end\n end\n end",
"def data\n @data ||= begin\n (normalized.data.is_a?(Hash)) ? normalized.data :\n JSON.parse(normalized.data.gsub('=>', ':'))\n rescue JSON::ParserError => e\n {}\n end\n end",
"def json_to_hash(json_data)\n\t\treturn JSON.parse(json_data, :symbolize_names => true)\t\n\tend",
"def processraw str, keys\n str.readlines.collect do |l|\n spltline = l.chomp.split \"|\"\n returning Hash.new do |h|\n keys.each_index do |i|\n h[keys[i]] = spltline[i] unless keys[i] == :ignore\n end\n end\n end\n end",
"def constructHashFromFile(input)\n\t\t\tresult = Hash.new()\n\t\t\tsize = input.size/6\n\t\t\tfor i in 0..size-1\n\t\t\t\talimento = Alimento.new(input[6*i], input[6*i+1].to_f, input[6*i+2].to_f, input[6*i+3].to_f, input[6*i+4].to_f, input[6*i+5].to_f)\n\t\t\t\tresult.store(input[6*i] , alimento )\n\t\t\tend\n\t\t\treturn result\n\t\tend",
"def get_data_from_json_file(filename)\n file_to_parse = File.read(filename)\n data_hash = JSON.parse(file_to_parse)\n return data_hash\nend",
"def read(s_or_h)\n case s_or_h\n when String\n @data = s_or_h.split(\"\\n\").map do |h|\n next unless h.include?(':')\n\n k, v = h.split(':', 2)\n [k, v.strip]\n end.compact.to_h\n when Hash\n @data = s_or_h\n end\n self\n end",
"def hash\n @data[:asin].to_s.hash\n end",
"def load(data)\n end",
"def parse_data(metadata)\n data=Hash.new\n data['hostname'][email protected]\n\n [email protected]\n data['name']=metricname\n\n data['spoof'][email protected]\n data['format'][email protected]\n\n metrictype=name_to_type(metricname,metadata)\n\n if metrictype.nil?\n # Probably we got a data packet before a metadata packet\n #puts \"Received datapacket without metadata packet\"\n return nil\n end\n\n data['val']=parse_value(metrictype)\n\n # If we received a packet, last update was 0 time ago\n data['tn']=0\n return data\n end",
"def to_hashed(tile_data)\n tokenized = tile_data.split(\",\").map{|x| x.to_i}\n tiles = []\n i = 0\n while i < tokenized.length do\n x = x_coord(tokenized[i])\n y = y_coord(tokenized[i])\n index = tokenized[i+1]\n tiles << {x: x, y: y, index: index}\n i += 3\n end\n tiles\nend",
"def load_data\n data = {}.with_indifferent_access\n\n %w[.json .yaml].each do |ext|\n Dir.glob(\"#{DATA_DIR}/*#{ext}\") do |fname|\n key = File.basename(fname, ext).to_sym\n puts \"Loading data[:#{key}] from #{fname}...\"\n data[key] =\n if ext == '.json'\n JSON.parse(File.read(fname))\n else\n Psych.parse(fname)\n end\n end\n end\n\n data\n end",
"def simple_parse(filename)\n hash = {}\n data = File.open(filename) do |io| \n # this makes it work with ruby 1.9:\n io.set_encoding(\"ASCII-8BIT\") if io.respond_to?(:set_encoding)\n io.read \n end\n data.split(/\\r?\\n/).select {|v| v =~ /^[a-z]/}.each do |line|\n if line =~ /([^\\s]+)\\s*=\\s*([^;]+)\\s*;?/\n hash[$1.dup] = $2.rstrip\n end\n end\n hash\nend",
"def dissect_to_record_hashes\n end",
"def read_data_object( filename )\n\n data_dir = self.config['data_dir'] || '_data'\n data_path = File.join(self.config['source'], data_dir)\n if File.symlink?(data_path)\n return \"Data directory '#{data_path}' cannot be a symlink\"\n end\n file = File.join(data_path, filename)\n\n return \"File #{file} could not be found\" if !File.exists?( file )\n \n result = nil\n Dir.chdir(data_path) do\n rows = []\n CSV.foreach(filename, headers: true, col_sep: ',') do |row|\n rows << row.to_hash\n end\n result = rows\n end\n puts \"## Error: No data in #{file}\" if result.nil?\n result = JSON.parse( result.to_json ) if result\n { 'data' => result,\n 'mtime' => File.mtime(file) }\n end",
"def should_be_hash(data)\n if data.class != Hash\n raise \"Data needs to be a hash, you passed in a #{data.class}: #{data}\"\n end\n end",
"def read_login_data\n login_data_file = 'login.data'\n Hash[*File.read(login_data_file).split(/[ \\n]+/)]\n end",
"def parse_into_hash(file_content)\n # apt-history file is seperated by double new line\n file_sections = file_content.split(\"\\n\\n\")\n\n # split the sections by line within them\n file_sections.map! { |section| section.split(\"\\n\") }\n\n # split each line of the sections by : seperator\n file_sections.map! do |section|\n section.map! do |line|\n line.partition(\": \").values_at(0, 2) # we don't need the seperator\n end\n section.to_h # Now make a hash of key-value pairs from 2-D array\n end\n end",
"def readIDSFile(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^;;/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][:ids] = a[2].to_u\n end\n end\nend",
"def string_to_hash(str)\n hash_data = eval(str)\n hash_data\n end",
"def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend",
"def data; Marshal.load(Base64.decode64(read_attribute(:data))); end",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend",
"def from_human(data)\n read(data)\n end",
"def rekey_data(data)\n {\n id: data.fetch(\"id\"),\n question: {\n lemma: data.fetch(\"question\").fetch(\"lemma\"),\n prompt: data.fetch(\"question\").fetch(\"prompt\")\n }\n }\n end",
"def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend",
"def hash\n require 'yaml'\n hash = YAML.load(File.read(self.yaml_file)) #gets hash from yaml file\n return hash\n end",
"def to_h\n data_fields = EXTERNAL_DATA\n data_fields << :id\n data_fields << :read_count\n data = Hash.new\n data_fields.each do |field|\n if self.respond_to?(field)\n value = self.send(field)\n data[field] = value unless !value\n else\n puts \"ERROR: yaml field not present: #{field}\"\n end\n end\n # ensure these aren't editable afterwards\n cloned_data = Marshal.load(Marshal.dump(data))\n cloned_data\n end"
] | [
"0.6626663",
"0.661975",
"0.65698576",
"0.6552171",
"0.65259594",
"0.64041775",
"0.6398365",
"0.6392176",
"0.6370021",
"0.6370021",
"0.6367444",
"0.63283986",
"0.6327749",
"0.62052035",
"0.62016857",
"0.61756444",
"0.61227816",
"0.6105781",
"0.60416776",
"0.60343856",
"0.5990656",
"0.5982779",
"0.59412944",
"0.5917278",
"0.5914509",
"0.58759916",
"0.5867385",
"0.5853967",
"0.58399546",
"0.58021986",
"0.5797725",
"0.5792435",
"0.5735359",
"0.5731752",
"0.5725556",
"0.57224315",
"0.5709989",
"0.5695939",
"0.5692018",
"0.5690876",
"0.5677984",
"0.56731033",
"0.5670052",
"0.5665571",
"0.56620514",
"0.56558543",
"0.56554353",
"0.5653033",
"0.5631004",
"0.5631004",
"0.5629287",
"0.5628462",
"0.5625497",
"0.562407",
"0.56165296",
"0.56085527",
"0.55995864",
"0.5598927",
"0.5598306",
"0.5595888",
"0.5580703",
"0.55699956",
"0.5556411",
"0.55387765",
"0.5531633",
"0.5531488",
"0.55131173",
"0.5499719",
"0.54969543",
"0.5495756",
"0.54951763",
"0.5486794",
"0.5472365",
"0.5464661",
"0.545068",
"0.5447314",
"0.54421115",
"0.5442101",
"0.5439385",
"0.54375404",
"0.54351443",
"0.5414368",
"0.5412005",
"0.54012334",
"0.5397593",
"0.53867865",
"0.53836113",
"0.53827626",
"0.53774995",
"0.5372692",
"0.5369498",
"0.5369328",
"0.536759",
"0.5367273",
"0.53656703",
"0.5365039",
"0.53586525",
"0.53554624",
"0.53490746",
"0.5344496",
"0.53414786"
] | 0.0 | -1 |
Why is this necessary? Perhaps just to initialize form, does not save... Would it work with required params? How to do req'd params? | def new
@photo = Photo.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_form_data(params = {})\n from_params(params, false)\n end",
"def form_setup\n\tend",
"def initialize\n @params = {} # Mimics params hash available within controllers in rails app\n end",
"def valid_params?; end",
"def valid_params_request?; end",
"def form_params\n params.fetch(:form, {})\n end",
"def set_prefecture\n params.require(:id, :name)\n end",
"def form_params\n @form_params ||= FormParamsController.new config\n end",
"def form; end",
"def form_data?; end",
"def injection_form\n # Nothing to do here\n end",
"def initialize(params = {})\n super\n self.is_valid = true\n end",
"def initialize(form)\n @form = form\n end",
"def initialize(form_object)\n @form_object = form_object\n end",
"def form_data_initialize(form)\n form = form_generation(form)\n form = 0 unless GameData::Pokemon.all[id][form]\n @form = form\n exp_initialize\n end",
"def form_params\n params.fetch(:form, {}).permit(:key, :name)\n end",
"def forms; end",
"def _form\n @comment = Comment.new\n end",
"def form_params\n params.require(:form).permit(:name, :alias, :type, :active, :structure_id, :user_id)\n end",
"def setup_form\n build_form\n super\n end",
"def default_form_builder; end",
"def user_params\n params.require(:choice)\n end",
"def order_form_params\n params.require(:order_form).permit(:supplier_name, :supplier_id, :total_price, :user_id , :product_id, :reviewer_id, :time, :number, :remark, :priority, :state)\n # params.fetch(:order_form, {})\n end",
"def validate_create_params!(params); end",
"def set_form\n #@form = Form.find(params[:id])\n end",
"def crud_form(*attrs, &block)\n options = attrs.extract_options!\n attrs = default_crud_attrs - %i[created_at updated_at] if attrs.blank?\n attrs << options\n standard_form(path_args(entry), *attrs, &block)\n end",
"def set_form(easy)\n end",
"def initialize(params = {}, required_keys = nil)\n super\n end",
"def initialize(params = {}, required_keys = nil)\n super\n end",
"def ing_form; end",
"def initialize(params)\n @first_name = params[:user][:first_name]\n @last_name = params[:user][:last_name]\n @company_name = params[:user][:company][:company_name]\n @email = params[:user][:email]\n @password = params[:user][:password]\n end",
"def initialize(request)\n @params = {}\n @params.merge! request.class.query_parse(request.params[\"QUERY_STRING\"])\n \n # Check to see if a form was submitted and fill in the form values\n if request.is_multipart?\n @params.merge! request.split_multipart\n end #if\n end",
"def form_params\n location_args.merge(units: @units, appid: @api_key)\n end",
"def form_params\n params[:form]\n end",
"def new\n load_form_data\n @book = Book.new\n end",
"def internalform_params\n params.permit( :goal, :infu_id)\n end",
"def some_thing_params\n params.require(:some_thing).permit(:val)\n end",
"def initialize\n super()\n @params = {}\n end",
"def memorial_params\n params.require(:memorial)\n end",
"def form_params\n params.require(:form).permit(:name, :user_id, :search, :description, :parent_id,\n :status, :version_independent_id, :control_number)\n end",
"def new\n # refs #373 - rails 3 - having this blank method fixes the problem\n end",
"def submission_params\n params[:submission] ||= {lazy: true}\n params.require(:submission).permit!\n end",
"def configure_form(var_oid, use_format, form_field_name, form_field_oid, form_field_label)\n wait_for_add_new\n add_new.click\n wait_for_variable_oid\n variable_oid.set var_oid\n format.set use_format\n field_name.set form_field_name\n field_oid.set form_field_oid\n label.set form_field_label\n save_form.first.click\n end",
"def initialize(req, route_params = {})\n @params = {}\n @params = @params.merge(route_params)\n parse_www_encoded_form(req.query_string) if req.query_string\n parse_www_encoded_form(req.body) if req.body\n end",
"def custom_form_params\n params.require(:custom_form).permit!\n end",
"def initialize_dispense\n # if we haven't come from a find, then preset some attributes needed by the form\n if !self.id.present?\n# additional initialization here\n\t\t\t\telse\n\t\t\t\t\tself.just_fill_date = self.fill_time\n\t\t\t\t\tself.just_fill_time = self.fill_time\n end\n\n end",
"def obj_params\n params.require(:data).require(:attributes)\n end",
"def start_with_default_params!\n default_params = upper(:@@default_params) || {}\n @params.reverse_merge!(default_params)\n end",
"def submitted_exam_regis_form_params\n params.fetch(:submitted_exam_regis_form, {})\n end",
"def initialize(params)\n require_keys([:firstName, :lastName, :email, :password], params)\n merge!(params)\n end",
"def initialize(params)\n @entity_type = params[\"entity_type\"]\n @params = params\n @params[:form_data] = {}\n @entity_config = nil\n end",
"def update_form(params)\n params.reject do |key, _value|\n attribute_parameter?(key)\n end.each do |key, value|\n self[key.to_sym] = SmartAttributes::AttributeFactory.build(key, default_attributes(key)) if self[key.to_sym].nil?\n self[key.to_sym].value = value\n end\n end",
"def set_up_form(form_class, form)\n # Set an instance variable for the form (eg. @conviction_approval_form) using the provided class\n instance_variable_set(\"@#{form}\", form_class.new(@resource))\n end",
"def crud_params\n params.require(:crud).permit(:field1, :field2)\n end",
"def initialize params = nil\n \n end",
"def initialize\n @params = {}\n end",
"def user_params\n params.require(:user)\n end",
"def initialize(params)\n super\n\n @email = @params[:email]\n @name = @params[:name]\n end",
"def new\n @question = Question.new\n @survey = Survey.find(params[:survey_id])\n @question.required_field = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def set_reform_survey\n @reform_survey = params[:action] == 'new' ? ReformSurvey.new : params[:action] == 'create' ? @reform_survey = ReformSurvey.new(reform_survey_params) : ReformSurvey.find(params[:id])\n end",
"def form_params\n params.require(:form).permit(:name, :description)\n end",
"def build_params\n hash = build(\"#{singular_key}_form\").\n public_send(\"#{singular_key}_attributes\")\n\n hash = hash.each_with_object({}) do |(key, value), object|\n object[\"#{singular_key}_#{key}\"] = value\n end\n\n { \"#{singular_key}_form\".to_sym => hash }\n end",
"def form_params\n params.require(:culvert).permit(Culvert.new.allowable_params)\n end",
"def get_params\r\n #params.require(:widget).permit(:name)\r\n params.require(:widget).permit!\r\n end",
"def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def initialize_fields\n publisher.build if publisher.empty?\n contributor.build if contributor.empty?\n creator.build if creator.empty?\n identifier.build if identifier.empty?\n description.build if description.empty?\n super\n end",
"def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\n end",
"def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end",
"def default_params\n {}\n end",
"def initialize(options = {})\n @account = options[:account] # optional, required for update\n @account_type = options[:account_type] # optional, required for build\n @account_params_key = options[:account_params_key] # computed; optional, used for testing\n @current_user = options[:current_user] # required\n @facility = options[:facility] # optional\n @owner_user = options[:owner_user] # optional, required for build\n @params = options[:params] || ActionController::Parameters.new # optional\n end",
"def spoofForm(val)\n @deltaflag = false\n @form = val\n end",
"def set_form\n @form = Form.find(params[:id])\n end",
"def set_form\n @form = Form.find(params[:id])\n end",
"def model_form(params={})\n # {{{\n method = params[:action]\n instance = params[:instance]\n klass = params[:model]\n klass ||= @klass\n\n custom_elements = {}\n log { \"Custom Form Elements: #{custom_form_elements.inspect}\" }\n custom_form_elements.each_pair { |clause, value|\n clause_parts = clause.to_s.split('.')\n table = clause_parts[0..1].join('.')\n attrib = clause_parts[2]\n custom_elements[table] = Hash.new unless custom_elements[table]\n custom_elements[table][attrib.to_sym] = value\n }\n view = @@form_generator.new(klass)\n view.labels = Lang[plugin_name]\n view.custom_elements = custom_elements\n form = view.form\n\n form.add(GUI::Hidden_Field.new(:name => :action, :value => method.to_s, :required => true)) if method\n form.add(GUI::Hidden_Field.new(:name => :controller, :value => klass.model_name.to_s, :required => true))\n\n form_values = {}\n default_form_values.each_pair { |attrib, value|\n form_values[attrib.to_s] = value\n }\n \n if instance then\n instance.attribute_values.each { |table, args| \n args.each { |name, value|\n form_values[\"#{table}.#{name}\"] = value\n }\n }\n klass.get_primary_keys.each { |table, keys|\n keys.each { |key|\n pkey_field_name = \"#{table}.#{key}\"\n form.add(GUI::Hidden_Field.new(:name => pkey_field_name, \n :value => instance.attribute_values[table][key], \n :required => true))\n }\n }\n end\n \n if(defined? form_groups) then\n form.fields = form_groups\n end\n if(defined? form_hints) then\n form.hints = form_hints\n end\n\n form.set_values(form_values)\n\n title_key = (klass.table_name).gsub('.','--')+'--add'\n form.title = (Lang[plugin_name][title_key]) unless Lang[plugin_name][title_key] == title_key\n klassname = @klass.to_s.gsub('Aurita::','').gsub('Main::','').gsub('Plugins::','').gsub('::','__').downcase\n form.name = klassname + '_' << method.to_s + '_form'\n form.id = klassname + '_' << method.to_s + '_form'\n\n log('Update form fields: ' << form.fields.inspect)\n log('Update form elements: ' << form.element_map.keys.inspect)\n return form\n end",
"def build_resource(permitted_params = {})\n session[:department_id] ||= params[:department_id]\n permitted_params.merge!(department_id: params[:department_id] || session[:department_id])\n\n self.resource = RegistrationForm.new(permitted_params)\n end",
"def initialize(form, form_field, field, language)\n @form = form\n @form_field = form_field\n @field = field\n @language = language\n end",
"def widget_form_params\n params.fetch(:widget_form, {})\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def set_form\n @form = Form.find(params[:form_id])\n end",
"def form_params\n params.require(:form).permit(:nombre, :apellidos, :cedula, :email, :telefono, :institucion, :unidad, :cargo, :profesion, :user_id)\n end",
"def build_form\n super\n raise ActionController::RoutingError, 'Not Found' unless work_type_specified?\n @form.payload_concern = params[:payload_concern]\n end",
"def like_params\n params.require(:real_estate)\n end",
"def initialize( params )\n super( Parametrization.permit( params, whitelist, model_name ) )\n @params = @params.with_indifferent_access # After building the internal params hash, make it a little friendlier.\n end",
"def build_permitted_params\n super + [\n { date_of_work_attributes: permitted_time_span_params },\n { inscription_attributes: permitted_inscription_params },\n { additional_credit_attributes: permitted_additional_credit_params },\n after: [],\n artist: [],\n attributed_to: [],\n author: [],\n addressee: [],\n creator_of_work: [],\n contributor: [],\n editor: [],\n engraver: [],\n interviewee: [],\n interviewer: [],\n manner_of: [],\n school_of: [],\n manufacturer: [],\n photographer: [],\n printer: [],\n printer_of_plates: [],\n publisher: [],\n place_of_interview: [],\n place_of_manufacture: [],\n place_of_publication: [],\n place_of_creation: [],\n ]\n end",
"def user_params\nend",
"def initialize(req, route_params = {})\n @params = parse_www_encoded_form(req.query_string)\n @params.merge!(parse_www_encoded_form(req.body))\n @params.merge!route_params\n end",
"def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end",
"def pre_initialize_fields\n end",
"def new\n \n @form =Forms.new \n end",
"def user_params\n end",
"def set_form\n @form = Form.find(params[:id])\n end",
"def form_fields\n params\n end",
"def initialize(params)\n setMake(params[:make]);\n setModel(params[:model]);\n setYear(params[:year]);\n commitCar!();\n\n end",
"def initialize(form, field, type)\n @klass = form.object.class\n @template = form.template\n @year = form.object.year\n @field = field\n @type = type\n end",
"def user_params\r\n end",
"def citizen_form_params\n params.require(:citizen_form).permit(:name, :date_of_birth, :bio, :twitter, :github, :website, :user_id)\n end",
"def initialize(form, current_user, coauthorships = nil)\n @form = form\n @current_user = current_user\n @coauthorships = coauthorships\n end",
"def formulario_params\n\n params.require(:formulario).permit(:nome, filial_ids: [], formulario_fields_attributes: [:id, :label, :field_type_id, :options, :url, :requirido, :_destroy], contact_group_ids: [])\n\n # if params[:tipo] != nil\n # [params.require(:formulario).permit(:nome),\n # params.require(:tipo).permit!,\n # params.require(:label).permit!,\n # params.require(:rec).permit!]\n # else\n # [params.require(:formulario).permit(:nome),nil,nil,nil]\n # end\n\n end",
"def form\n end"
] | [
"0.64748764",
"0.6414771",
"0.63863987",
"0.63350594",
"0.6161817",
"0.61546624",
"0.6150104",
"0.60950994",
"0.6082215",
"0.6055543",
"0.60401106",
"0.599685",
"0.59786904",
"0.59725475",
"0.5954255",
"0.59137285",
"0.5891296",
"0.58832115",
"0.585872",
"0.58354104",
"0.5812618",
"0.5810675",
"0.5789064",
"0.5788475",
"0.5722944",
"0.57102615",
"0.57061976",
"0.569902",
"0.569902",
"0.5688355",
"0.56779057",
"0.5672334",
"0.566496",
"0.5663998",
"0.56596655",
"0.5652081",
"0.5650683",
"0.564794",
"0.5630629",
"0.56253463",
"0.5623462",
"0.5622092",
"0.56104875",
"0.56077904",
"0.5606972",
"0.56044364",
"0.5601747",
"0.559993",
"0.5597727",
"0.55760646",
"0.55735916",
"0.5570642",
"0.556775",
"0.5565361",
"0.5564533",
"0.5561159",
"0.5552202",
"0.5546423",
"0.5541294",
"0.55398357",
"0.5539192",
"0.5538596",
"0.55362856",
"0.553594",
"0.5531193",
"0.55259746",
"0.55224955",
"0.55188036",
"0.55160403",
"0.55100816",
"0.55089355",
"0.5507535",
"0.5507535",
"0.550477",
"0.550425",
"0.5503295",
"0.54924935",
"0.5492085",
"0.5492085",
"0.5492085",
"0.5492085",
"0.5486338",
"0.5480114",
"0.54793006",
"0.5466543",
"0.5463762",
"0.54634464",
"0.5461679",
"0.54587793",
"0.5457298",
"0.5450264",
"0.54497015",
"0.54386806",
"0.5435817",
"0.5432404",
"0.54321766",
"0.54318887",
"0.543021",
"0.5427917",
"0.54270834",
"0.54261625"
] | 0.0 | -1 |
Initialize with the password | def initialize(password, size=256, mode="cbc")
@password = password
@size = size
@mode = mode
@cipher = OpenSSL::Cipher::Cipher.new("aes-#{size}-#{mode}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(password)\n @password = password\n end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def passwd\r\n @password = \"12345\"\r\n end",
"def initialize(args)\n if args.respond_to?(:keys)\n @password = args.delete(:password)\n end\n super(args)\n if @password\n self.send(:password=)\n else\n @password = ShadowHash.create_from_user_record(self)\n end\n end",
"def initialize user, pass\n @user, @pass = user, pass\n end",
"def initialize(user_id, password)\n\t\t@user_id = user_id \n\t\t@password = password\n\tend",
"def password\n @password = Password.new(password_hash) unless password_hash.blank?\n end",
"def set_default_password\r\nself.password = :random\r\nend",
"def initialize(user, password=nil)\n @user, @password = user, password\n end",
"def initialize(email, password) \n\t\t@email = email \n\t\t@password = password \n\t\t#puts\n\tend",
"def initialize(email_id, password)\n @email_id = email_id\n @password = password\n end",
"def passwd=(p0) end",
"def passwd=(p0) end",
"def initialize(login, password)\n @login = login\n @password = password\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def password\n @password ||= Password.new(password_hash)\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def password=(new_password); end",
"def initialize(username, password)\n @username = username\n @password = password\n end",
"def initialize(username, password)\n @username = username\n @password = password\n end",
"def initialize(username, password)\n @username = username\n @password = password\n end",
"def initialize(username,password)\n @username = username\n @password = password\n end",
"def password\n @password ||= Password.new(password_digest)\n end",
"def password=(password)\n @password = password\n end",
"def password(password)\n @options[:password] = password\n end",
"def initialize(\n username: self.class.username,\n password: self.class.password\n )\n @username = username.to_s.clone\n @password = password.to_s.clone\n end",
"def initialize(email, password)\n self.email = email\n self.password = password\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password=(value)\n @password = value\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(attributes = nil)\n super\n @new_password = false\n end",
"def pass\n @pass ||= Password.new(self.password)\n end",
"def initialize(email, password = nil)\n @email = email\n @password = password\n end",
"def generate_password\n self.password = \"1234\"\n end",
"def initialize(email, password)\n @email = email\n @password = password\n end",
"def initialize(options = {})\n requires!(options, :password)\n @options = options\n super\n end",
"def password= password\n @password = password\n\n self.password_digest = BCrypt::Password.create password\n end",
"def initialize(password:, confirmation:, code:)\n @password = password\n @confirmation = confirmation\n @code = code\n super(nil)\n end",
"def password\n @password||=@options['password']\n end",
"def password\n @password ||= Password.new(self.hashed_password)\n end",
"def set_password pass\n self.pass_salt = SHA256Salt.generate_random\n self.pass_hash = WodaHash.digest(self.pass_salt + pass).to_hex\n end",
"def password=(value)\n\t\t\t@password = value\n\t\tend",
"def password\n\t\tPassword.new( attribute_get(:password) )\n\tend",
"def initialize(user, pass)\n @auth = {:username => user, :password => pass}\n end",
"def prepare_password\n unless password.blank?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = encrypt_password(password)\n end\n end",
"def initialize(username, password)\n @username = username\n @password = password\n @production_number = generate_production_number\n end",
"def set_password; nil; end",
"def password= password\n @password = password\n encrypt_password!\n end",
"def set_password(password) \n\t\t#Generate salt\n\t\tbase = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten\n\t\tsalt = (0...50).map{ base[rand(base.length)] }.join\n\t\t\n\t\tenc_password = Digest::SHA1.hexdigest(salt+password)\n\t\t\n\t\tself.salt = salt\n\t\tself.password = enc_password\n\t\tself.temp_password = nil\n\t\tself.save\n\tend",
"def add_password(password)\n @password = password\n end",
"def set_temp_password\n self.password = SecureRandom.urlsafe_base64(6)\n end",
"def password\n @password ||= ::BCrypt::Password.new(password_digest)\n end",
"def initialize(project, password)\n @project, @password = project, password\n end",
"def initialize(username = nil, password = nil)\n authenticate(username, password) if username and password\n end",
"def password=(password)\n \t@password = password\n self.password_digest = BCrypt::Password.create(password)\n end",
"def set_password(pass)\n self.user_password = User.crypt(pass)\n end",
"def password=(should); end",
"def password\n @password ||= opts.fetch(:password, parsed_opt('password'))\n end",
"def set_password(password)\n @password = Base64.encode64(password)\n end",
"def password(value)\n @config[:password] = value\n end",
"def set_password\n @password = Password.last\n @new_password = Password.new\n end",
"def initialize(username, password)\n @username = username\n @password = password\n\n exit unless login\n end",
"def password=(password)\n validate_options(password: password)\n @password = password\n end",
"def password\n super\n end",
"def initialize\n @nif = nil\n @password = nil\n end",
"def initialize(digest)\n digest = digest.to_s\n\n # FIXME: Behavior duplicated by HashFormat guard clause, remove here?\n raise Argon2::Errors::InvalidHash unless valid_hash?(digest)\n\n # Split the digest into its component pieces\n split_digest = split_hash(digest)\n # Assign each piece to the Argon2::Password instance\n @digest = digest\n @variant = split_digest[:variant]\n @version = split_digest[:version]\n @t_cost = split_digest[:t_cost]\n @m_cost = split_digest[:m_cost]\n @p_cost = split_digest[:p_cost]\n @salt = split_digest[:salt]\n @checksum = split_digest[:checksum]\n end",
"def password=(password)\n self.password_digest = BCrypt::Password.create(password)\n \tend",
"def initialize(username=nil, password=nil)\n login(username, password) if username and password\n end",
"def initialize(username=nil, password=nil)\n login(username, password) if username and password\n end",
"def password\n nil\n end",
"def initialize(name, password_plain, password_md5)\n raise ArgumentError.new(Rack::AARM::DSL::Helpers::ARGUMENTS_BAD) unless name.is_a? String and name.strip.size > 0\n raise ArgumentError.new(Rack::AARM::DSL::Helpers::ARGUMENTS_BAD) unless password_plain.is_a? String and password_plain.strip.size > 0\n raise ArgumentError.new(Rack::AARM::DSL::Helpers::ARGUMENTS_BAD) unless password_md5.is_a? String and password_md5.strip.size > 0\n @name, @password_plain, @password_md5 = name, password_plain, password_md5\n @active_ranges, @rights = [], []\n end",
"def password\n @password ||= BCrypt::Password.new(h_password)\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password\n @password\n end",
"def password=(str)\n @password = str\n self.password_digest = User.digest(str)\n end"
] | [
"0.84076387",
"0.75638866",
"0.75638866",
"0.75638866",
"0.75638866",
"0.7420939",
"0.73517483",
"0.7315896",
"0.73049206",
"0.7219563",
"0.72090065",
"0.7203744",
"0.719083",
"0.71710145",
"0.71501815",
"0.71501815",
"0.71437067",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.7128355",
"0.71100104",
"0.71100104",
"0.71100104",
"0.71100104",
"0.71100104",
"0.7099463",
"0.7087478",
"0.7087478",
"0.7087478",
"0.7066966",
"0.7058183",
"0.70563316",
"0.7041151",
"0.70297",
"0.70156884",
"0.7001198",
"0.7001198",
"0.7001198",
"0.7001198",
"0.7001198",
"0.7001198",
"0.69884723",
"0.6982577",
"0.6982577",
"0.6976454",
"0.6969726",
"0.6967174",
"0.6963305",
"0.6948012",
"0.69435453",
"0.6938274",
"0.6924765",
"0.6914751",
"0.69114435",
"0.6893629",
"0.6889395",
"0.6887776",
"0.6871785",
"0.6853451",
"0.6848222",
"0.6834753",
"0.68299717",
"0.6829349",
"0.68181926",
"0.6813591",
"0.6805435",
"0.680505",
"0.6802013",
"0.6797058",
"0.6793397",
"0.6793374",
"0.678823",
"0.67841184",
"0.6783846",
"0.67751086",
"0.6769469",
"0.676929",
"0.676918",
"0.6718728",
"0.67112476",
"0.67111874",
"0.67031664",
"0.67031664",
"0.6702686",
"0.67022616",
"0.6700753",
"0.66967565",
"0.66967565",
"0.6672035",
"0.6672035",
"0.66638696"
] | 0.0 | -1 |
GET /organization_members/1 GET /organization_members/1.xml | def show
@organization_member = OrganizationMember.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @organization_member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_members(org)\n get \"/orgs/#{org}/members\"\n end",
"def show\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization_membershipship }\n end\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def organization_public_members(org)\n get \"/orgs/#{org}/public_members\"\n end",
"def index\n @memberships = @organization.memberships.all\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @organization }\n\t\tend\n\tend",
"def index\n @family_members = @current_family.family_members\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @family_members }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def members\n raw_response = get_request('users/members')\n parse_response(raw_response, :users)\n end",
"def new\n @organization_member = OrganizationMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_member }\n end\n end",
"def index\n @organizations = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organizations }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n @address = @organization.address\n @member = Member.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def members\n return @members if @members\n @members = Client.get(\"/organizations/#{id}/members/all\").json_into(Member)\n end",
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def index\n\t\t@organizations = Organization.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @organizations }\n\t\tend\n\tend",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def show\n @organization_detail = OrganizationDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization_detail }\n end\n end",
"def show\n @network = current_organization.networks.find(params[:id])\n @members = @network.organizations.find(:all, :conditions => ['organizations.id <> ?', current_organization.id]) \n end",
"def index\n respond_to do |format|\n format.html { render :layout => 'yui_t7_custom' } # index.rhtml\n format.xml { render :xml => @members.to_xml }\n end\n end",
"def index\n @namespaces = current_user.namespaces\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @namespaces }\n end\n end",
"def show\n @membership = Membership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @membership }\n end\n end",
"def index\n @members = Defer { ::Member.all }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @members }\n end\n end",
"def index\n @organization = Organization.find_by_id(params[:organization_id])\n if @organization\n @users = @organization.users\n else\n @status = :fail\n @data = {organization: \"Organization #{params[:organization_id]} not found.\"}\n render status: :not_found, json: json_response(:fail, data: @data)\n end\n end",
"def get\r\n\t\t#binding.pry\r\n\t\ttemplateFile = 'api/v1/users/members/get'\r\n\t\tunless (params[:id].to_i != 0 ) #will get the current user id if its nil or 0\r\n\t\t\tparams[:id] = session[:user].id\r\n\t\t\ttemplateFile = 'api/v1/users/members/getFull'\r\n\t\tend\r\n @responseObject = OpenStruct.new({\r\n status: true,\r\n errors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n objectData: OpenStruct.new(User.getFullUserData(params[:id])),\r\n timestamp: (Date.new).to_time.to_i.abs\r\n })\r\n \trender :template => templateFile ,:handlers => [:rabl], :formats => [:json]\r\n\tend",
"def show\n\t\t@membership = Membership.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @membership }\n\t\tend\n\tend",
"def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end",
"def get_members_for_org organization_name\n # Need to call GET /orgs/:org/members\n # Member names will be the keys in our @stats hash, so we can keep them there\n GithubApi.get(\"/orgs/#{organization_name}/members\").each do |m|\n member_name = m[\"login\"]\n # Initially, no additions, deletions, or changes\n @stats[ member_name ] = { \"a\" => 0, \"d\" => 0, \"c\" => 0 }\n end\n end",
"def index\n @independents = @member.independents\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @independents }\n end\n end",
"def account_organization\n get('account/organization')\n end",
"def index\n @pending_affiliations = Affiliation.find_all_not_approved\n @approved_affiliations = Affiliation.find_approved\n respond_to do |format|\n format.html { render :layout => 'admin' } # index.rhtml\n format.xml { render :xml => @members.to_xml }\n end\n end",
"def show\n @organisation = Organisation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organisation }\n end\n end",
"def show\n @member_info = MemberInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @member_info }\n end\n end",
"def index\n @units = OrganizationalUnit.find(:all, :order => \"sort_order, lower(abbreviation)\", :include => [:members,:organization_abstracts, :primary_faculty, :joint_faculty, :secondary_faculty])\n @heading = \"Current Org Listing\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @units }\n end\n end",
"def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end",
"def show\n @member = Member.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @member.to_xml }\n end\n end",
"def show\n @account_membership = AccountMembership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_membership }\n end\n end",
"def index\n @organs = Organ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @organs }\n end\n end",
"def list_org\n @users = User.where(organization: true)\n\n render \"list_org\"\n end",
"def list_members\n HTTP.headers(:accept => @@accept, \"content-type\" => @@content_type).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/members\").parse[\"members\"]\n end",
"def organization\n _get(\"/account/organization\") { |json| json }\n end",
"def index\n @members = @project.memebers\n end",
"def show\n @member = Member.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def show\n @members = User.with_membership(budget_domain_id: @budget_domain.id)\n end",
"def index\n @users = User.all\n render :xml => @users\n end",
"def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end",
"def memberships\n @list.client.get(\"#{url}/memberships\")\n end",
"def new\n @organizations = Organization.find(:all)\n @organization_user = OrganizationUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_user }\n end\n end",
"def show\n @independent = @member.independents.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @independent }\n end\n end",
"def fetch\n @members = []\n page = 0\n\n begin\n page += 1\n url = open(\"#{base_url}/memberslistxml?p=#{page}\", {:proxy => true})\n member_data = REXML::Document.new(url.read).root\n\n @group_id64 = member_data.elements['groupID64'].text.to_i if page == 1\n total_pages = member_data.elements['totalPages'].text.to_i\n\n member_data.elements['members'].elements.each do |member|\n @members << SteamId.new(member.text.to_i, false)\n end\n end while page < total_pages\n\n super\n end",
"def show\n\t\t@member = Member.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @member }\n\t\tend\n\tend",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teammembers }\n end\n end",
"def getOrgMemberList\n\t\torgMemberList = @ghClient.org_members(@organization.to_s)\n\t\torgMemberListRaw = JSON.parse(@ghClient.last_response.body)\n\t\t\n\t\t# Debug Code\n\t\t# puts \"Got Organization member list, Github rate limit remaining: \" + @ghClient.rate_limit.remaining.to_s\n\t\t\n\t\tif orgMemberListRaw.empty? == false\n\t\t\torgMemberListRaw.each do |y|\n\t\t\t\ty[\"organization\"] = @organization\n\t\t\t\ty[\"repo\"] = @repository\n\t\t\t\ty[\"downloaded_at\"] = Time.now\n\t\t\tend\n\t\t\torgMemberListRaw = self.putIntoMongoCollOrgMembers(orgMemberListRaw)\n\t\t\treturn orgMemberListRaw\n\t\tend\n\tend",
"def destroy\n @organization_member = OrganizationMember.find(params[:id])\n @organization_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_members_url) }\n format.xml { head :ok }\n end\n end",
"def list_users(api_object)\r\n puts \"Current Users:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n names = doc.xpath('users').collect {|e| e.text }\r\n puts names.join(\", \")\r\n puts \"\"\r\nend",
"def index\n @organizations = Organization.all\n respond_with @organizations\n end",
"def show\n @profile = self.current_member.profile\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @profile.to_xml }\n end\n end",
"def index\n @members = User::Member.all\n end",
"def xml_profile_list(xml) \n if current_user \n profiles = current_user.profiles.map{|p| p.title}.join(',') \n return render(:text => \"<Response>#{profiles}</Response>\") \n end \n render :text => '<Response>Internal Error</Response>' \n end",
"def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end",
"def members\n users\n end",
"def members\n users\n end",
"def index\n @committeemembers = Committeemember.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @committeemembers }\n end\n end",
"def show\n @member = Member.find(params[:id])\n #@members = Member.paginate(:page => params[:page])\n @title = @member.last_name\n #respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @member }\n #end\n end",
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def index\n @organizations = Organization.all\n respond_with(@organizations)\n end",
"def show\n @who_member = WhoMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @who_member }\n end\n end",
"def index\n @restmembers = Restmember.all\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end",
"def index\n @members = Member.find(:all)\n end",
"def index\n @organizations = Spree::Organization.all\n end",
"def index\n @groups = Group.where('owner_id' => current_user.id)\n @memberships = Membership.all\n respond_with(@groups, @memberships)\n end",
"def show\n authorize @organization_membership\n render json: @organization_membership\n end",
"def index\n @memberships = @user.memberships\n\n respond_to do |format|\n format.html # index.rhtml\n end\n end",
"def list \n @organizations = Organization.all\n \n render \"list\"\n end",
"def get_members()\n @client.make_request(:get, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"))[0].map do |i|\n member = ConferenceMember.new(i, @client)\n member.conference_id = id\n member\n end\n end",
"def index\n @people = current_organization.people.all\n end",
"def members\n response = service.get_members\n response.map do |member_data|\n Member.new(member_data)\n end\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n end",
"def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=20071208033821</facebig>\n\t <sex>1</sex>\n\t <vip>3</vip>\n\t <isconfirm>1</isconfirm>\n\t</user>\n </users_getInfo_response>\n XML\n end",
"def index\n @user_groups = UserGroup.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_groups }\n end\n end",
"def show\n @organization = Organization.find(params[:id])\n respond_with @organization\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def index\n @members = Member.all\n end",
"def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :org_guid => HttpClient::Preconditions.assert_class_or_nil('org_guid', HttpClient::Helper.to_uuid(opts.delete(:org_guid)), String),\n :org_key => HttpClient::Preconditions.assert_class_or_nil('org_key', opts.delete(:org_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :role => HttpClient::Preconditions.assert_class_or_nil('role', opts.delete(:role), String),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/memberships\").with_query(query).get.map { |hash| Apidoc::Models::Membership.new(hash) }\n end"
] | [
"0.7295145",
"0.687698",
"0.6818822",
"0.66467535",
"0.65676236",
"0.65206504",
"0.6487884",
"0.64422154",
"0.6428098",
"0.6428098",
"0.641447",
"0.6376002",
"0.6356502",
"0.63134",
"0.6310896",
"0.62411803",
"0.6232414",
"0.6210289",
"0.6210289",
"0.62077457",
"0.61892927",
"0.61770934",
"0.61603844",
"0.61414635",
"0.6132934",
"0.61233735",
"0.6120231",
"0.61162335",
"0.6101496",
"0.6073078",
"0.6068013",
"0.6058123",
"0.60550696",
"0.6035639",
"0.59998775",
"0.59962523",
"0.5987126",
"0.5986799",
"0.59857607",
"0.59686375",
"0.5958533",
"0.5958346",
"0.59544533",
"0.5920393",
"0.5920078",
"0.59185416",
"0.5891199",
"0.5887582",
"0.58821577",
"0.587381",
"0.58564085",
"0.58549464",
"0.5846737",
"0.5839561",
"0.58355343",
"0.5835182",
"0.5828905",
"0.5827039",
"0.58269614",
"0.5821126",
"0.5818266",
"0.58174247",
"0.58090395",
"0.57936954",
"0.57935995",
"0.5791527",
"0.5791527",
"0.5784616",
"0.5776629",
"0.57752717",
"0.5770248",
"0.57653826",
"0.57560766",
"0.5753592",
"0.5753592",
"0.57530576",
"0.57369703",
"0.57284456",
"0.57240397",
"0.5715939",
"0.5714246",
"0.56997025",
"0.56992096",
"0.5692624",
"0.5690299",
"0.56897396",
"0.56879675",
"0.56877273",
"0.5687262",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5686329",
"0.5679066"
] | 0.7271967 | 1 |
GET /organization_members/new GET /organization_members/new.xml | def new
@organization_member = OrganizationMember.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @organization_member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @organizations = Organization.find(:all)\n @organization_user = OrganizationUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_user }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n\t\t@membership = Membership.new\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @membership }\n\t\tend\n\tend",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def create\n @organization_member = OrganizationMember.new(params[:organization_member])\n\n respond_to do |format|\n if @organization_member.save\n format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully created.') }\n format.xml { render :xml => @organization_member, :status => :created, :location => @organization_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@organization = Organization.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @organization }\n\t\tend\n\tend",
"def new\n @member = Member.new\n @title = \"New member\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member }\n end\n end",
"def new\n\t\t@member = Member.new(:membership_id => params[:membership_id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @member }\n\t\tend\n\tend",
"def new\n @organization = Organization.new\n session[:breadcrumbs].add \"New\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"def new\n @member_info = MemberInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member_info }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family_member }\n end\n end",
"def create_member\n # Member.create!..\n\n respond_to do |format|\n format.html { redirect_to organization_path(params[:orgaid])}\n format.json { head :no_content }\n end\n end",
"def new\n @participating_organization = ParticipatingOrganization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participating_organization }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end",
"def new\n @organization_detail = OrganizationDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_detail }\n end\n end",
"def new\n @member = Member.new\n @member.email = @search_string ||= \"\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member}\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"def new\n @node = Node.new\n @node.owner = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\r\n @org = Org.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @org }\r\n end\r\n end",
"def new\n @organ = Organ.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organ }\n end\n end",
"def new\n @who_member = WhoMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @who_member }\n end\n end",
"def new\n @position_member = PositionMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position_member }\n end\n end",
"def new\n @membership_kind = MembershipKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @membership_kind }\n end\n end",
"def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"def new\n @teammember = Teammember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @teammember }\n end\n end",
"def create\n @member = @organization.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n logger.info(\"User #{current_user.email} created Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully created.' }\n #format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n @committeemember = Committeemember.new\n @clubusers = User.find(:all, :order => \"surname ASC\")\n @title = \"Create New Committee Member\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @committeemember }\n end\n end",
"def new\n @user = User.new(:organization_id => current_org.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @alliance_member = AllianceMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @alliance_member }\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @memberapp = Memberapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @memberapp }\n end\n end",
"def new\n @organization = Organization.new\n respond_with(@organization)\n end",
"def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @namespace = Namespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @namespace }\n end\n end",
"def new\n @organization = Organization.new\n end",
"def new\n @organization = Organization.new\n end",
"def new\n @organization = Organization.new\n end",
"def new\n @organization = Organization.new\n end",
"def new\n @organization = Organization.new\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @user = User.new\n render :xml => @user\n end",
"def new\n @organiser = Organiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organiser }\n end\n end",
"def new\n @organization = Organization.new\n @organization.name = params[:name]\n @organization.url = params[:url]\n @organization.homepage_url = params[:homepage_url]\n @organization.address = params[:address]\n\n authorize! :new, @organization\n\n @title = new_action_title\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"def new\n @person = Person.new\n @person.names.new\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @account_membership = AccountMembership.new\n @account = Account.find params[:account_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account_membership }\n end\n end",
"def new\n @organization_profile = OrganizationProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization_profile }\n end\n end",
"def new\n\t@user = User.new\n\t@organizations = Organization.all\n end",
"def new\n @game_member = GameMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game_member }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end",
"def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @total_owner = TotalOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @total_owner }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end",
"def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @member = Member.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @organization_user = @organization.organization_users.new\n end",
"def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration }\n end\n end",
"def new\n @independent = @member.independents.build\n @independent.name_last = @member.name.split(\" \")[1] unless @member.name.nil?\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @independent }\n end\n end",
"def new\n @organization_account = OrganizationAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization_account }\n end\n end",
"def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def new\n @project_user = ProjectUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_user }\n end\n end",
"def create\n @member = Member.new(params[:member])\n @member.new = false\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to members_url(@member) }\n format.xml { head :created, :location => member_url(@member) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def new\n\tif !checkadmin? then return end #\n\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end",
"def new\n @group_member = GroupMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_member }\n end\n end",
"def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end",
"def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end",
"def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end",
"def new\n @registration = Registration.new()\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end",
"def new\n @special_groups_user = SpecialGroupsUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @special_groups_user }\n end\n end"
] | [
"0.7509134",
"0.73715734",
"0.73713",
"0.73713",
"0.7358503",
"0.7248141",
"0.72430134",
"0.71214586",
"0.71153355",
"0.71034074",
"0.71034074",
"0.71034074",
"0.7038471",
"0.7033218",
"0.70084536",
"0.70000273",
"0.6998842",
"0.6946194",
"0.6883773",
"0.6874757",
"0.68259585",
"0.68165994",
"0.6803016",
"0.6803016",
"0.6778348",
"0.6747871",
"0.67431074",
"0.67199814",
"0.6705571",
"0.6695331",
"0.66678953",
"0.66474104",
"0.6647393",
"0.6635193",
"0.66348404",
"0.6624766",
"0.6622073",
"0.66167545",
"0.66159004",
"0.66139305",
"0.6599885",
"0.6577147",
"0.656627",
"0.6565289",
"0.6565289",
"0.6565289",
"0.6565289",
"0.6565289",
"0.6565289",
"0.6565289",
"0.654659",
"0.6532246",
"0.651045",
"0.651045",
"0.651045",
"0.651045",
"0.651045",
"0.6496771",
"0.6496771",
"0.64896816",
"0.64823174",
"0.64695424",
"0.6465597",
"0.64652663",
"0.64652663",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.6462138",
"0.64519405",
"0.64471555",
"0.6444043",
"0.6438751",
"0.6436944",
"0.6430336",
"0.64289165",
"0.6421609",
"0.64170253",
"0.640992",
"0.64095277",
"0.64070344",
"0.63956666",
"0.63938874",
"0.6385722",
"0.6378635",
"0.6378545",
"0.6369417",
"0.6366331",
"0.6361567",
"0.63600725",
"0.63600725",
"0.63600725",
"0.6358545",
"0.63571745"
] | 0.7959692 | 0 |
POST /organization_members POST /organization_members.xml | def create
@organization_member = OrganizationMember.new(params[:organization_member])
respond_to do |format|
if @organization_member.save
format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully created.') }
format.xml { render :xml => @organization_member, :status => :created, :location => @organization_member }
else
format.html { render :action => "new" }
format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @member = @organization.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n logger.info(\"User #{current_user.email} created Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully created.' }\n #format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_member\n # Member.create!..\n\n respond_to do |format|\n format.html { redirect_to organization_path(params[:orgaid])}\n format.json { head :no_content }\n end\n end",
"def create\n @organization_membership = OrganizationMembership.new(organization_membership_create_params)\n # authorize @organization_membership\n\n if @organization_membership.save\n render json: @organization_membership, status: :created, location: nil\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n # create an associated Org_user\n @org_user = OrgUser.new\n @org_user.organization_id = @organization.id\n @org_user.user_id = current_user.id\n @org_user.save\n\n # On default create a membership to the OrgUser/Admin/person_that_created_the_org\n @membership = Membership.new\n @membership.individual_id = current_user.individual.id\n @membership.organization_id = @organization.id\n @membership.save\n\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = @organization.memberships.build(membership_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization_membershipship = current_person.organization_memberships.new(:organization_id => params[:organization_id])\n\n respond_to do |format|\n if @organization_membershipship.save\n format.html do \n @org = @organization_membershipship.organization \n if @org.root.requires_validation?\n case @org.root.validation_method\n when 'relay'\n redirect_to('https://signin.ccci.org/cas/login?service=' + validate_person_organization_membership_url(current_person, @organization_membershipship))\n end\n else\n redirect_to(session[:return_to].present? ? session[:return_to] : :back, :notice => 'Organization membership was successfully created.') \n end\n end\n format.xml { render :xml => @organization_membershipship, :status => :created, :location => @organization_membershipship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization_membershipship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def organization_params\n params.require(:organization).permit(:name, :description, :owner_id, :members)\n end",
"def new\n @organization_member = OrganizationMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_member }\n end\n end",
"def CreateMembership params = {}\n \n APICall(path: 'group_memberships.json',method: 'POST',payload: params.to_json)\n \n end",
"def postEntityAssociation_membership( entity_id, association_id, association_member_url, association_member_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['association_id'] = association_id\n params['association_member_url'] = association_member_url\n params['association_member_id'] = association_member_id\n return doCurl(\"post\",\"/entity/association_membership\",params)\n end",
"def organization_members(org)\n get \"/orgs/#{org}/members\"\n end",
"def create\n @organization = Organization.new(organization_params)\n @organization.access_token = ('a'..'z').to_a.shuffle[0,32].join\n\n respond_to do |format|\n if @organization.save\n OrganizationMembership.create(user_id: current_user.id, organization_id: @organization.id, admin: true)\n params[:departments].each do |d_id|\n DepartmentEntry.create(context: @organization, department_id: d_id)\n end\n format.html { redirect_to :dashboard, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_membership(organization_id, params)\n http.post(membership_endpoint(organization_id), body: params) do |response|\n response.parsed_body\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to new_project_path, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n @organization.memberships.create(user_id: current_user.id)\n organization_info = {\n pretext: \"A new organization has been created.\",\n fallback: \"#{@organization.name}: #{@organization.description}\",\n title: \"#{@organization.name}\",\n title_link: \"#{organization_url(@organization)}\",\n text: \"#{@organization.description}\",\n color: \"#BDD6DD\",\n }\n PROJECT501_NOTIFIER.ping(attachments: [organization_info])\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = @current_enterprise.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @organization.save\n @organization.registrations << @registration if @registration\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save && @organization.associate_user(current_user, ['admin'])\n User.add_user_to_group(@organization, ['admin'], params[:admin1_email], params[:admin1_first_name], params[:admin1_last_name], params[:admin1_phone] ) if (params[:admin1_email].present?)\n User.add_user_to_group(@organization, ['admin'], params[:admin2_email], params[:admin2_first_name], params[:admin2_last_name], params[:admin2_phone] ) if (params[:admin2_email].present?)\n \n format.html { redirect_to organization_path(@organization), notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_members\n project = Project.find(params[:id])\n\n params[:members].each do |member_id|\n user = User.find(member_id)\n project.users << user unless project.users.include?(user) \n end\n \n respond_to do |format|\n format.html { redirect_to project_path(@project), notice: 'members were successfully added.' }\n format.json { render json: @project, status: :created, location: @project }\n end\n end",
"def create\n @member = @space.members.new(member_params)\n @member.user = current_user\n\n respond_to do |format| \n if @member.save\n @space.members << @member\n\n format.html { redirect_to space_member_url(@space, @member), notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: [@space, @member] }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n current_user.organization_users.build(organization_user_params)\n @organization = Organization.find(organization_user_params[:organization_id])\n respond_to do |format|\n if current_user.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { redirect_to @organization, error: 'Organization creation failed.' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = @member.memberships.build(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership.member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_groups_membership = OsGroupsMembership.new(os_groups_membership_params)\n\n respond_to do |format|\n if @os_groups_membership.save\n format.html { redirect_to @os_groups_membership, notice: 'Os groups membership was successfully created.' }\n format.json { render :show, status: :created, location: @os_groups_membership }\n else\n format.html { render :new }\n format.json { render json: @os_groups_membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = current_user.build_organization(organization_params)\n respond_to do |format|\n if @organization.save\n format.html { redirect_to root_path, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.get_id_from_location_header(headers[:location])\n get_member(id)\n end",
"def create_organization_and_subscription_plan\n organization = Organization.create(\n name: \"My Organization\",\n subscription_plan_id: self.subscription_plan_id,\n time_zone: self.time_zone\n )\n\n organization_membership = organization.add_user(self)\n organization_membership.role = :owner\n organization_membership.save\n end",
"def CreateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n flash[:notice] = 'Member Created' if @project.members << @member\n respond_with @project, @member\n end",
"def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to groups_path, notice: 'User was successfully added to group.' }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.new(member_params)\n unless @member.set_region_admin == \"1\"\n @member.region_id = current_member.region_id\n end\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n @uplines = Member.order(\"fullname\")\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully created.\" }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization.save\n respond_with(@organization)\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def create\n @user_organization = UserOrganization.new(user_organization_params)\n\n respond_to do |format|\n if @user_organization.save\n format.html { redirect_to @user_organization, notice: 'User organization was successfully created.' }\n format.json { render :show, status: :created, location: @user_organization }\n else\n format.html { render :new }\n format.json { render json: @user_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @memberships = @organization.memberships.all\n end",
"def create\n @admins_organization = Organization.new(admins_organization_params)\n\n respond_to do |format|\n if @admins_organization.save\n format.html { redirect_to @admins_organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @admins_organization }\n else\n format.html { render :new }\n format.json { render json: @admins_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(name: params[:name], owner: params[:username]) #owner: params[:username]\n if @organization.save\n #binding.pry\n @owner = @organization.employees.new(username: params[:username], \n password: params[:password], \n organization_id: @organization.id,\n email: params[:email],\n admin: true)\n if @owner.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @owner.errors.full_messages }, status: :unprocessable_entity\n end\n\n else\n render json: { errors: @organization.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\n @organization = Organization.new(params[:organization])\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @organization.valid? && @user.valid? && @organization.save && @user.save\n @user.has_role 'manager', @organization\n self.current_user = @user\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to @organization }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sign_up\n\t\tif params[:uuid].present?\n\t\t\t@existing_member = Com::Nbos::User.where(uuid: params[:uuid])\n\t\t\tif @existing_member.present?\n\t\t\t\trender :json => @existing_member.first\n\t\t\telse\n\t\t\t\t@member = build_user(params)\n\t\t\t\tif @member && @member.save\n\t\t\t\t\trender :json => @member\n\t\t\t\telse\n\t\t\t\t\trender :json => {status: 500, message: @member.errors.messages}, status: 500\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender :json => {status: 400, message: \"Bad Request\"}, status: 400\n\t\tend\t\n\tend",
"def create\n @participating_organization = ParticipatingOrganization.new(params[:participating_organization])\n\n respond_to do |format|\n if @participating_organization.save\n format.html { redirect_to(participating_organizations_path, :notice => 'Participating Organization was successfully created.') }\n format.xml { render :xml => @participating_organization, :status => :created, :location => @participating_organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participating_organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = current_user.organizations.build(params[:organization])\n if @organization.save\n redirect_to @organization, :flash => { :success => \"Profile created!\" }\n else\n render 'pages/home'\n end\n end",
"def create\n @membership = Membership.new(params[:membership])\n @membership.member = current_member\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to sub_clubs_path, :notice => 'You requested membership.' }\n format.json { render :json => @membership, :status => :created, :location => @membership }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @organizations = Organization.find(:all)\n @organization_user = OrganizationUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_user }\n end\n end",
"def create\n\t\t@organization = Organization.new(params[:organization])\n\n\t\trespond_to do |format|\n\t\t\tif @organization.save\n\t\t\t\tformat.html { redirect_to(@organization, :notice => 'Organization was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @organization, :status => :created, :location => @organization }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @membership = Membership.new(membership_params)\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: \"Membership was successfully created.\" }\n format.json { render :show, status: :created, location: @membership }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_user_organization_creating\n user = User.named(\"me\")\n member = User.named(\"you\")\n org1 = Organization.named(\"org1\")\n org2 = Organization.named(\"org2\")\n\n org1.add_admin(user)\n\n assert(user.is_admin_of?(org1), \"failed adding admin\")\n assert(!user.is_admin_of?(org2), \"admin in wrong organization\")\n\n org1.add_member(member)\n org2.add_member(member)\n\n assert(member.is_member_of?(org1), \"failed adding member\")\n assert_equal(member.organizations, [org1, org2], \"is in wrong organization\")\n end",
"def post(member, request_opts={})\n unless member.is_a?(User)\n raise DataTypeError.new(\"User object is expected, but got [#{member.inspect}]\")\n end\n member = GroupMember.new(:group_id => self.id, :member_id => member.id)\n http(request_opts).post(resolved_path, member.as_hash)\n end",
"def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save\n format.html { redirect_to organization_path(@organization), notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n member = Member.create\n @group.members << member\n current_user.members << member\n\n @group.owner = member\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n r = params[:member]\n @member = Member.where(:email => r[:email], :group_name => r[:group_name], :admin_uuid => session[:user_uuid]).first\n r = @member.attributes.merge(r) unless @member.nil?\n @member = Member.new(r) if @member.nil?\n @member.update_attributes(r) unless @member.nil?\n\n unless @member.err\n @member.get_member_uuid\n end\n respond_to do |format|\n unless @member.nil?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization_status = OrganizationStatus.new(create_organization_status_params)\n @organization_status.participant = Current.user\n @organization_status.save\n respond_with @organization_status, location: -> { @organization_status.organization }\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Spree::Organization.new(organization_params)\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Spree::Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @family = Family.new(family_params)\n addMembers\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\n format.json { render :show, status: :created, location: @family }\n else\n format.html { render :new }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n r = params[:member]\n @member = Member.where(:email => r[:email], :group_name => r[:group_name], :admin_uuid => session[:user_uuid]).first\n r = @member.attributes.merge(r) unless @member.nil?\n @member = Member.new(r) if @member.nil?\n @member.update_attributes(r) unless @member.nil?\n unless @member.err\n @member.get_member_uuid\n end\n respond_to do |format|\n unless @member.nil?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people_organization = PeopleOrganization.new(people_organization_params)\n\n respond_to do |format|\n if @people_organization.save\n format.html { redirect_to @people_organization, notice: 'People organization was successfully created.' }\n format.json { render :show, status: :created, location: @people_organization }\n else\n format.html { render :new }\n format.json { render json: @people_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = Membership.new(params[:membership])\n\n respond_to do |format|\n if @membership.save\n format.html { redirect_to @membership, notice: 'Membership was successfully created.' }\n format.json { render json: @membership, status: :created, location: @membership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @organization_member = OrganizationMember.find(params[:id])\n @organization_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_members_url) }\n format.xml { head :ok }\n end\n end",
"def create_membership\n member = Member.new(squad: @squad, user: current_user, membership: 'owner')\n member.save(validate: false)\n end",
"def create\n\t\t@membership = Membership.new(params[:membership])\n\n\t\trespond_to do |format|\n\t\t\tif @membership.save\n\t\t\t\tformat.html { redirect_to(@membership, :notice => 'Membership was successfully created.') }\n\t\t\t\tformat.xml\t{ render :xml => @membership, :status => :created, :location => @membership }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml\t{ render :xml => @membership.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n ip = request.location\n @user = current_user\n @group = @user.groups_as_owner.new(params[:group])\n params[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n @group.school_id = @user.school_id\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n if organization_params[:manual_fee_entry] == \"0\" || organization_params[:manual_fee_entry].nil?\n @organization.amount_owe = @organization.tournament.price*@organization.clubs.size\n end\n respond_to do |format|\n if @organization.save\n EventMailer.tournament_registration(@organization).deliver\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n @tournaments = Tournament.active_tournaments\n @organization.clubs.build if @organization.clubs.empty?\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.post(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/$ref\", { \n \n body: user_create.to_json,\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n \"Content-Type\" => 'application/json', \n\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end",
"def create\n if check_if_field_empty(member_params)\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n else\n @member = User.new(member_params)\n @member.tenant_id = current_tenant.id\n respond_to do |format|\n if @member.save\n add_roles(params[:roles])\n format.html { redirect_to member_path(@member), notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n if params[:membership][:user_username]\n params[:membership][:user_id] = User.find_by_username(params[:membership].delete('user_username')).try!(:id)\n end\n\n @membership = @project.memberships.create(membership_params)\n respond_with @project, @membership\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create(params, membership)\n # Send payload to blip\n data = {\n initials: (params[4].nil? ? params[5][0] : params[4].tr('^a-zA-Z', '')),\n firstname: (params[5].nil? ? params[4][0] : params[5]),\n lastname: [params[6], params[7]].reject{|e| e.nil? or e.empty?}.join(' '),\n email: (params[3].nil? ? '[email protected]' : params[3]),\n gender: params[9] == 'Vrouw' ? 'F' : 'M',\n phone: params[14],\n mobile: params[2],\n phone_parents: params[24],\n address: [params[10], params[11], params[12]].join(' '),\n membership: membership,\n }\n begin\n unless params[15].nil?\n data[:dateofbirth] = Date.strptime(params[15], '%d-%m-%Y').strftime('%Y-%m-%d')\n end\n rescue\n $problems.write \"#{$index}, #{data[:firstname]} #{data[:lastname]}, Birthdate ignored\\n\"\n end\n blip = post('https://people.i.bolkhuis.nl/persons', data)\n\n # Grab uid\n unless blip == nil\n uid = blip['uid']\n\n # Send payload to operculum\n put(\"https://operculum.i.bolkhuis.nl/person/#{uid}\", {\n nickname: params[8],\n study: params[16],\n alive: params[17].nil?,\n inauguration: params[25],\n resignation_letter: params[26],\n resignation: params[27],\n })\n end\nend",
"def create\n\t\t@member = Member.new(params[:member])\n\n\t\trespond_to do |format|\n\t\t\tif @member.save\n\t\t\t\tformat.html { redirect_to(@member.membership, :notice => 'Member was successfully created.') }\n\t\t\t\tformat.xml\t{ render :xml => @member, :status => :created, :location => @member }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml\t{ render :xml => @member.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @organization = Organization.new(params[:organization])\n \n \n respond_to do |format|\n if @organization.save\n User.updateOrg(current_user.id,@organization.id)\n \n @album = Album.new\n @album.name = @organization.name\n @album.save\n @organization.album_id = @album.id\n Organization.updateAlbum(@organization.id,@album.id)\n \n current_user.has_role!('owner', @organization)\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @membership = Adhocracy::Membership.new(membership_params)\n\n if @membership.save\n render json: @membership, status: :created, location: api_v1_membership_path(@membership)\n else\n render_validation_errors @membership.errors\n end\n end",
"def new\n\t\t@membership = Membership.new\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @membership }\n\t\tend\n\tend",
"def create\n @group = current_user.groups.build(:name => params[:group][:name])\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'new'\n end\n\n end",
"def create\n @project = Project.new(params[:project])\n user = User.find_by_id(session[:user_id])\n\n respond_to do |format|\n if @project.save\n @project.members.create(:user_id => user.id, :member_role_id => MemberRole.find_or_create_by_role(\"creator\").id)\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.create_with_owner(organization_params, current_user)\n\n if @organization.save\n @organization.notify_and_update_classes\n redirect_to @organization, notice: 'Organization was successfully created.'\n else\n set_errors_render(@organization, :new)\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n @organization.assignments << Assignment.new({user: current_user, organization: @organization, is_admin: true, is_active: true})\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_member = @client.group_members.new(group_member_params)\n respond_to do |format|\n if @group_member.save\n format.html { redirect_to client_group_member_path(@client,@group_member), notice: 'Group member was successfully created.' }\n format.json { render :show, status: :created, location: @group_member }\n else\n format.html { render :new }\n format.json { render json: @group_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #sanity checks, can only modify memberships that you own\n if params[:user_id].to_i != current_user.id then\n render json: {message:'You do not own the membership list'}, :status => :unprocessable_entity\n return\n end\n\n #ensure the membership params is there\n unless params.has_key? :memberships then\n #render json: {message:'memberships list not found'}, :status => :unprocessable_entity\n #return\n #this could me no membership at all\n params[:memberships] = {}\n end\n\n #set the new memberships state\n current_user.set_memberships params[:memberships]\n\n render json: {\n message:'message received from server',\n memberships:User.find(params[:user_id]).memberships.map{ |x| x.attributes.merge({club_name: x.club_name})}\n }\n end",
"def create\n @member = Member.new(params[:member])\n\n respond_to do |format|\n if @member.save\n flash[:notice] = 'Member was successfully created.'\n format.html { redirect_to(@member) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def membership_params\n params.require(:membership).permit(:user_id, :group_id, :email, :title)\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def test_should_join_a_group_as_admin_via_API_JSON\r\n get \"/logout\"\r\n post \"/memberships.json\", :api_key => 'testapikey',\r\n :group_id => 1,\r\n :user_id => 1\r\n assert_response :created\r\n membership = JSON.parse(response.body)\r\n assert membership['user_id'] == 1, 'Incorrect user id'\r\n assert membership['group_id'] == 1, 'Incorrect group id'\r\n assert membership['role_id'].to_i == Role.find_by_rolename('group_admin').id, 'Incorrect role id' \r\n end",
"def test_should_join_a_group_as_user_via_API_JSON\r\n get \"/logout\"\r\n post \"/memberships.json\", :api_key => 'testapikey',\r\n :group_id => 1,\r\n :user_id => 3\r\n assert_response :created\r\n membership = JSON.parse(response.body)\r\n assert membership['user_id'] == 3, 'Incorrect user id'\r\n assert membership['group_id'] == 1, 'Incorrect group id'\r\n assert membership['role_id'].to_i == Role.find_by_rolename('user').id, 'Incorrect role id' \r\n end",
"def create\n @member = Member.new(params[:member])\n respond_to do |format|\n if @member.save\n flash[:notice] = 'El socio se guardo con exito.'\n format.html { redirect_to(members_path) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group_organization = GroupOrganization.new(group_organization_params)\n\n respond_to do |format|\n if @group_organization.save\n format.html { redirect_to @group_organization, notice: 'Group organization was successfully created.' }\n format.json { render :show, status: :created, location: @group_organization }\n else\n format.html { render :new }\n format.json { render json: @group_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #not_allowed\n @oc_member = OcMember.new(params[:oc_member])\n\n respond_to do |format|\n if @oc_member.save\n format.html { redirect_to @oc_member, notice: 'Oc member was successfully created.' }\n format.json { render json: @oc_member, status: :created, location: @oc_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @oc_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def member_params\n params.require(:member).permit(:name, :email, :type, :is_project_manager)\n end",
"def create\n @organization = Organization.new(organization_params)\n\n if @organization.save\n render :show, status: :created, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"def create\n @lab_membership = LabMembership.new(params[:lab_membership])\n @user = @lab_membership.user\n\n respond_to do |format|\n if @lab_membership.save\n flash[:notice] = 'LabMembership was successfully created.'\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { render :xml => @lab_membership, :status => :created, :location => @lab_membership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lab_membership.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @member_info = MemberInfo.new(params[:member_info])\n\n respond_to do |format|\n if @member_info.save\n format.html { redirect_to(@member_info, :notice => 'MemberInfo was successfully created.') }\n format.xml { render :xml => @member_info, :status => :created, :location => @member_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @member_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def bulk_create_team_members(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/team-members/bulk-create',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create_membership_request\n member = Member.new(squad: @squad, user: current_user, membership: 'request')\n member.save(validate: false)\n end",
"def update\n @organization_member = OrganizationMember.find(params[:id])\n\n respond_to do |format|\n if @organization_member.update_attributes(params[:organization_member])\n format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @member = GroupMember.new(params[:member])\n if @current_member.group.add_member @member\n render :json=>{success:true, new_id:@member.id}\n UserMailer.invite_email(@member.email).deliver\n else\n render :json=>{success:false, errors:@member.errors}\n end\n end",
"def create\n\n\t\tgroup = ResearchGroup.find(research_group_member_params[:research_group_id])\n\t\temployee = Employee.find(research_group_member_params[:employee_id])\n\n\t\tif group.nil? or employee.nil? or group.members.include? employee\n\t\t\tredirect_to :back\n\t\telse\n\t\t\tgroup.members << employee\n\t\t\tredirect_to group\n\t\tend\n end",
"def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response :created\r\n end",
"def member_params\n params.require(:member).permit(:first_name, :last_name, :title, :organization_id, :summary, :full_text_bio, :url, :picture)\n end",
"def create_org_member\n @organization = Organization.find(params[:organization_id].to_i)\n @email = params[:email]\n\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @pw = params[:password]\n @pw_confirmation = params[:password_confirmation]\n\n # TODO check if authtoken is in sess variable\n # If so, only update user password\n \n # Allocate User account, dashboard, and profile \n @user = User.create(\n email: @email,\n password: @pw,\n password_confirmation: @pw_confirmation,\n organization: @organization\n )\n if @user\n Dashboard.create(\n lead_email: @email, \n lead_name: \"#{@first_name} #{@last_name}\",\n user: @user\n )\n\n profile = Profile.find_or_create_by!(email: @email) do |profile|\n profile.first_name = @first_name\n profile.last_name = @last_name\n profile.dashboard_registered = true\n end\n\n profile.update(user: @user)\n\n # Create zoho lead record\n if [email protected]? && @organization.name != 'test'\n ZohoService.save_to_zoho(profile)\n end\n\n #sign in newly created user\n sign_in(@user, scope: :user)\n # Setting up alias to map user id to mixapanel unique id. So we can use userid moving forward\n mixpanel_distinct_id = params[:distinct_id]\n @tracker.alias(@user.id,mixpanel_distinct_id)\n @tracker.people.set(@user.id,{\n '$first_name' => @user.profile.first_name,\n '$last_name' => @user.profile.last_name,\n '$email' => @user.email,\n '$phone' => @user.profile.phone\n },@user.current_sign_in_ip.to_s)\n @tracker.track(@user.id,'User account created for org. member')\n\n # flash[:notice] = 'Welcome to MyDomino!'\n \n render json: {\n message: 'User added',\n status: 200\n }, status: 200\n else\n render json: {\n message: 'Error adding user',\n status: 400\n }, status: 400\n end\n end"
] | [
"0.65905035",
"0.646108",
"0.61698675",
"0.6169194",
"0.6134789",
"0.61309856",
"0.60435045",
"0.59900796",
"0.5956035",
"0.591098",
"0.59048945",
"0.5894511",
"0.586154",
"0.58457935",
"0.5812234",
"0.57767683",
"0.5769082",
"0.57649314",
"0.5759263",
"0.57346636",
"0.56891066",
"0.5684086",
"0.5682473",
"0.56807554",
"0.56787026",
"0.56280535",
"0.56103283",
"0.5568919",
"0.55621195",
"0.55505586",
"0.5532803",
"0.5531563",
"0.55258816",
"0.5509136",
"0.5501969",
"0.5498566",
"0.5486041",
"0.5480582",
"0.54789335",
"0.5477005",
"0.5475931",
"0.5470028",
"0.5468332",
"0.5467534",
"0.5429385",
"0.5428888",
"0.5422992",
"0.54210526",
"0.5410344",
"0.5405919",
"0.54035527",
"0.5402724",
"0.5402724",
"0.5402724",
"0.5402724",
"0.5401804",
"0.5396008",
"0.5393276",
"0.5392023",
"0.5383194",
"0.5375813",
"0.53688425",
"0.5364673",
"0.5361859",
"0.53482646",
"0.53458685",
"0.53432935",
"0.5340805",
"0.533969",
"0.5324243",
"0.5323398",
"0.5316763",
"0.53142434",
"0.53084284",
"0.5307538",
"0.5306835",
"0.5305554",
"0.5292224",
"0.52892363",
"0.5272097",
"0.5270175",
"0.526615",
"0.5266048",
"0.52596956",
"0.52551675",
"0.5251715",
"0.5250061",
"0.52491987",
"0.52484906",
"0.524839",
"0.52399313",
"0.52388465",
"0.5228826",
"0.52223843",
"0.5220356",
"0.52184975",
"0.52153426",
"0.520758",
"0.5205571",
"0.5202588"
] | 0.69179714 | 0 |
PUT /organization_members/1 PUT /organization_members/1.xml | def update
@organization_member = OrganizationMember.find(params[:id])
respond_to do |format|
if @organization_member.update_attributes(params[:organization_member])
format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @organization.remove_members(params[:organization][:user_ids])\n\n if @organization.update_attributes(check_owner(organization_params))\n\n update_owner(@organization, organization_params[:owner_id])\n @organization.notify_and_update_classes\n\n redirect_to @organization, notice: 'Organization was successfully updated.'\n else\n set_errors_render(@organization, :edit)\n end\n end",
"def update\n authorize @organization_membership\n\n if @organization_membership.update(organization_membership_update_params)\n head :no_content\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :location => admin_organizations_path)\n end",
"def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(params[:organization])\n respond_with @organization\n end",
"def update\n respond_to do |format|\n if @organization.update_attributes( params[:organization],\n :as => ( permitted_to?( :admin, @organization ) ? :admin : :default ) )\n flash[:notice] = 'Organization was successfully updated.'\n format.html { redirect_to(@organization) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n\n respond_to do |format|\n if @organization_membershipship.update_attributes(params[:organization_membershipship])\n format.html { redirect_to(@organization_membershipship, :notice => 'Organization membership was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization_membershipship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n format.html { redirect_to @organization }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @organization.update(organization_params)\n respond_with(@organization)\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @organization.update_attributes(params[:organization])\n\t\t\t\tformat.html { redirect_to(@organization, :notice => 'Organization was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to admin_organization_path, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to admin_organization_path, notice: 'Organization could not be updated.' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n if current_user.has_role?('admin')\n @organization.is_pending = false\n end\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n format.html { redirect_to(@organization) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @organization.update(organization_params)\n if @organization.save\n render json: { success: \"organization updated successfully\"}, status: :ok\n else\n render json: { errors: @orgnanization.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def update\n if @organization.update(organization_params)\n render :show, status: :ok, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to edit_admin_organization_path(@organization), notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@organization.errors.full_messages.first}\"\n format.html { redirect_to edit_admin_organization_path(@organization) }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @organization.update(organization_params)\n render :show, status: :ok, location: @organization\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @user_organization.update(user_organization_params)\n format.html { redirect_to @user_organization, notice: 'User organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_organization }\n else\n format.html { render :edit }\n format.json { render json: @user_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n if @organization.update_attributes(params[:organization])\n redirect_to admin_organizations_url, :notice => t('organization.messages.update.success')\n else\n render action: \"edit\"\n end\n end",
"def destroy\n @organization_member = OrganizationMember.find(params[:id])\n @organization_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_members_url) }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to organization_path(@organization), notice: 'Организация успешно обновлена.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_group_user_via_API_JSON\r\n # lookup user's membership\r\n get \"memberships/find.json?api_key=testapikey&user_id=4&group_id=1\"\r\n membership = JSON.parse(response.body)\r\n membership_id = membership['id']\r\n assert membership_id == 3, 'Incorrect membership id'\r\n assert membership['role_id'] == Role.find_by_rolename('user').id, 'Incorrect role id'\r\n \r\n # promote user to group admin\r\n put \"/memberships/#{membership_id}.xml\", :api_key => 'testapikey',\r\n :membership => {:user_id => 4,\r\n :group_id => 1,\r\n :role_id => Role.find_by_rolename('group_admin') }\r\n assert_response :success\r\n end",
"def update\n @participating_organization = ParticipatingOrganization.find(params[:id])\n\n respond_to do |format|\n if @participating_organization.update_attributes(params[:participating_organization])\n format.html { redirect_to(participating_organizations_path, :notice => 'Participating Organization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participating_organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n #format.html { redirect_to(@organization) }\n format.html { redirect_to :controller => 'organizations', :action => 'show' , :organization=> @organization.site_name }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def organization_params\n params.require(:organization).permit(:name, :description, :owner_id, :members)\n end",
"def create\n @organization_member = OrganizationMember.new(params[:organization_member])\n\n respond_to do |format|\n if @organization_member.save\n format.html { redirect_to(@organization_member, :notice => 'Organization member was successfully created.') }\n format.xml { render :xml => @organization_member, :status => :created, :location => @organization_member }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization_member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @people_organization.update(people_organization_params)\n format.html { redirect_to @people_organization, notice: 'People organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_organization }\n else\n format.html { render :edit }\n format.json { render json: @people_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n params[:organization][:admin_email_to_add] = params[:organization_admin_email_to_add] if params[:organization]\n return false unless user_can_edit? @organization\n if @organization.update_attributes_with_admin(params[:organization])\n redirect_to @organization, notice: 'Organization was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n @organization_detail = OrganizationDetail.find(params[:id])\n\n respond_to do |format|\n if @organization_detail.update_attributes(params[:organization_detail])\n format.html { redirect_to(@organization_detail, :notice => 'OrganizationDetail was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to edit_organization_path(@organization), notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization_status.update(update_organization_status_params)\n respond_with @organization_status, location: lambda {\n organization_organization_statuses_path(@organization_status.organization)\n }\n end",
"def set_owner_member\n self.organizations << self.owner\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def update\n @external_organization = ExternalOrganization.find(params[:id])\n\n respond_to do |format|\n if @external_organization.update_attributes(params[:external_organization])\n format.html { redirect_to @external_organization, notice: 'External organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @external_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oc_member = OcMember.find(params[:id])\n\n respond_to do |format|\n if @oc_member.update_attributes(params[:oc_member])\n format.html { redirect_to @oc_member, notice: 'Oc member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oc_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = VALIDATION_MESSAGE[\"ORGANIZATION\"][\"UPDATE\"] rescue nil\n format.html { redirect_to admin_organization_path(@organization.id) }\n else\n flash[:error] = @organization.errors.full_messages.join(\", \")\n format.html { render :action => \"edit\",:id => @organization.id }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update!(**args)\n @organization_id = args[:organization_id] if args.key?(:organization_id)\n @organization_name = args[:organization_name] if args.key?(:organization_name)\n end",
"def update\r\n @org = Org.from_param(params[:abbr])\r\n\r\n respond_to do |format|\r\n if @org.update_attributes(params[:org])\r\n format.html { redirect_to @org, notice: 'Org was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @org.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n if organization_params[:manual_fee_entry] == \"0\"\n @organization.update_attribute(:amount_owe, @organization.tournament.price*@organization.clubs.size)\n end\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n @tournaments = Tournament.active_tournaments\n @organization.clubs.build if @organization.clubs.empty?\n format.html { render action: 'edit' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization_person = OrganizationPerson.find(params[:id])\n\n if @organization_person.update(organization_person_params)\n render json: @organization_person\n else\n render json: @organization_person.errors, status: :unprocessable_entity\n end\n end",
"def update\n @organization.user_updated_id = current_user.id\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Información actualizada satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_organization\n @attributes = organization_params[:organization]\n @attributes.delete(:id)\n #detects if incoming name/abbreviation is different from the old name/abbreviation\n name_change = @attributes[:name] != @organization.name || @attributes[:abbreviation] != @organization.abbreviation\n\n if @organization.update_attributes(@attributes)\n @organization.update_ssr_org_name if (@organization.type != \"Institution\" && name_change)\n update_services\n true\n else\n false\n end\n end",
"def set_membership\n @membership = @organization.memberships.find(params[:id])\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def update\n respond_to do |format|\n if @admins_organization.update(admins_organization_params)\n format.html { redirect_to @admins_organization, notice: 'Organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @admins_organization }\n else\n format.html { render :edit }\n format.json { render json: @admins_organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization.update(organization_params)\n format.html { redirect_to @organization, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_organization( params )\n\n raise ArgumentError.new(format('wrong type. \\'params\\' must be an Hash, given \\'%s\\'', params.class.to_s)) unless( params.is_a?(Hash) )\n raise ArgumentError.new('missing \\'params\\'') if( params.size.zero? )\n\n organization = validate( params, required: true, var: 'organization', type: String )\n name = validate( params, required: true, var: 'name', type: String )\n org = organization( organization )\n\n return { 'status' => 404, 'message' => format('Organization \\'%s\\' not found', organization) } if( org.nil? || org.dig('status').to_i != 200 )\n\n organization_id = org.dig('id')\n\n endpoint = format( '/api/orgs/%s', organization_id )\n payload = { name: name }\n\n @logger.debug(\"Update Organisation id #{organization_id} (PUT #{endpoint})\") if @debug\n\n put( endpoint, payload.to_json )\n end",
"def update\n @organization_profile = OrganizationProfile.find(params[:id])\n\n respond_to do |format|\n if @organization_profile.update_attributes(params[:organization_profile])\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_membership(organization_id, membership_id, params)\n http.put(\"#{membership_endpoint(organization_id)}/#{membership_id}\", body: params) do |response|\n Rexpense::Entities::Membership.new response.parsed_body\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n authorize! :update, @organization\n\n respond_to do |format|\n if @organization.update_attributes(permitted_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { @title = edit_action_title; render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @organization.update_attributes(organization_params)\n flash[:notice] = 'Organization updated!'\n # tells certain role (in common_actions) that an org (currently vendor)\n # is updated\n CommonActions.notification_process('Organization', @organization)\n end\n respond_with(@organization)\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n logger.info(\"User #{current_user.email} updated Member '#{@member.first_name} #{@member.last_name}' in properties \n '#{@member.audits.last.audited_changes}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_organization\n @organization = Organization.find(params[:name])\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"def update_owner(organization, owner_id)\n if owner_id\n new_owner = User.find(owner_id)\n\n unless new_owner.owns\n new_owner.organization = organization\n new_owner.save\n end\n end\n end",
"def update!(**args)\n @organization_mid = args[:organization_mid] if args.key?(:organization_mid)\n @organization_mid_label = args[:organization_mid_label] if args.key?(:organization_mid_label)\n @organization_name = args[:organization_name] if args.key?(:organization_name)\n @organization_url = args[:organization_url] if args.key?(:organization_url)\n @original_organization_name = args[:original_organization_name] if args.key?(:original_organization_name)\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def update\n @organization = current_tenant\n if @organization.user_signatures == \"\" || @organization.user_signatures.nil?\n @organization.user_signatures = []\n end\n respond_to do |format|\n if @organization.update_attributes(params[:organization].except(:user_signatures,:default_signature))\n format.html { redirect_to manage_edit_organization_path, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization_account = OrganizationAccount.find(params[:id])\n\n respond_to do |format|\n if @organization_account.update_attributes(params[:organization_account])\n format.html { redirect_to @organization_account, notice: 'Organization account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def show\n @organization_member = OrganizationMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @organization_member }\n end\n end",
"def create\n @organization = Organization.new(params[:organization])\n \n \n respond_to do |format|\n if @organization.save\n User.updateOrg(current_user.id,@organization.id)\n \n @album = Album.new\n @album.name = @organization.name\n @album.save\n @organization.album_id = @album.id\n Organization.updateAlbum(@organization.id,@album.id)\n \n current_user.has_role!('owner', @organization)\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_organization\n\t @organization = Organization.find(params[:id])\n\tend",
"def update(name, org_guid)\n org = @client.organization(org_guid)\n org.name = name\n org.update!\n end",
"def edit_organization(org, options={})\n patch \"/orgs/#{org}\", :body => options\n end",
"def set_organization\n # @org = Organization.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @member.update(member_params)\n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n @uplines = Member.where.not(id: @member.self_and_descendants.collect(&:id)).order(\"fullname\")\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @member_info = MemberInfo.find(params[:id])\n\n respond_to do |format|\n if @member_info.update_attributes(params[:member_info])\n format.html { redirect_to(@member_info, :notice => 'MemberInfo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Organization\n respond_to do |format|\n if @organization.update(organization_params)\n format.js\n else\n format.js { render :edit }\n end\n end\n end",
"def update\n @panel_organization_invitation = Panel::OrganizationInvitation.find(params[:id])\n\n respond_to do |format|\n if @panel_organization_invitation.update_attributes(params[:panel_organization_invitation])\n format.html { redirect_to(@panel_organization_invitation, :notice => 'Organization invitation was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_organization_invitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @member = Member.find(params[:id])\n respond_to do |format|\n if @member.update_attributes(params[:member])\n flash[:notice] = 'Member was successfully updated.'\n format.html { redirect_to member_url(@member) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @member.errors.to_xml }\n end\n end\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n end"
] | [
"0.6608563",
"0.65917176",
"0.6518058",
"0.6511707",
"0.6467627",
"0.6453962",
"0.6432147",
"0.642786",
"0.63439393",
"0.63212264",
"0.6280427",
"0.62447184",
"0.61718386",
"0.6122993",
"0.6117347",
"0.6117119",
"0.6045175",
"0.60414755",
"0.6035834",
"0.60353965",
"0.60353965",
"0.60353965",
"0.60353965",
"0.60353965",
"0.60353965",
"0.60353965",
"0.5990275",
"0.59766805",
"0.5968322",
"0.59615254",
"0.5958269",
"0.595753",
"0.59389687",
"0.5936085",
"0.5933873",
"0.5933873",
"0.5920325",
"0.59133893",
"0.5913325",
"0.5877402",
"0.58549565",
"0.5849144",
"0.58379614",
"0.5837809",
"0.58351606",
"0.58301365",
"0.58213663",
"0.58153355",
"0.58091366",
"0.57938886",
"0.57920635",
"0.5781601",
"0.57810706",
"0.57743585",
"0.5746291",
"0.574621",
"0.5728018",
"0.5727814",
"0.5725993",
"0.5708404",
"0.57057863",
"0.56945646",
"0.56926525",
"0.5685437",
"0.5665539",
"0.5665539",
"0.56638724",
"0.5650261",
"0.56377196",
"0.56320673",
"0.56320673",
"0.56320673",
"0.56320673",
"0.56274605",
"0.562059",
"0.5606001",
"0.56052196",
"0.56052196",
"0.55978656",
"0.5590919",
"0.55905944",
"0.5579652",
"0.5576233",
"0.5572987",
"0.55607617",
"0.5547284",
"0.55412245",
"0.5526404",
"0.5522371",
"0.55183166",
"0.5517692",
"0.55102867",
"0.55102867",
"0.55102867",
"0.55102867",
"0.55102867",
"0.55102867",
"0.55102867",
"0.55102867",
"0.55102867"
] | 0.71433866 | 0 |
DELETE /organization_members/1 DELETE /organization_members/1.xml | def destroy
@organization_member = OrganizationMember.find(params[:id])
@organization_member.destroy
respond_to do |format|
format.html { redirect_to(organization_members_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @organization_user = OrganizationUser.find(params[:id])\n @organization_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to(organizations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to(organizations_url) }\n format.xml { head :ok }\n end\n end",
"def delete(*args)\n arguments(args, required: [:org_name, :user])\n\n delete_request(\"/orgs/#{arguments.org_name}/members/#{arguments.user}\",\n arguments.params)\n end",
"def destroy\n @organization.destroy\n flash[:notice] = 'Organization was successfully removed.'\n\n respond_to do |format|\n format.html { redirect_to(organizations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.delete\n end",
"def destroy\n organization = @member.organization \n\n @member.destroy\n logger.info(\"User #{current_user.email} destroyed Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n respond_to do |format|\n format.html { redirect_to organization, notice: 'Member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization_detail = OrganizationDetail.find(params[:id])\n @organization_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n \n \n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def deleteEntityAssociation_membership( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/association_membership\",params)\n end",
"def destroy\n @participating_organization = ParticipatingOrganization.find(params[:id])\n @participating_organization.destroy\n\n respond_to do |format|\n format.html { redirect_to(participating_organizations_url) }\n format.xml { head :ok }\n end\n end",
"def DeleteOrganization id\n \n APICall(path: \"organizations/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy_member\n\n #@member = Member.find\n #@member.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @oc_member = OcMember.find(params[:id])\n @oc_member.destroy\n\n respond_to do |format|\n format.html { redirect_to oc_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n \n redirect_to admin_organizations_url, notice: t('organization.messages.delete.success')\n end",
"def destroy\n @organization.destroy\n end",
"def destroy\n\t\t@organization = Organization.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(organizations_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n @account_membership = AccountMembership.find(params[:id])\n @account_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_memberships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n respond_to do |format|\n format.html { redirect_to members_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n flash[:notice] = 'Person was successfully removed.'\n\n respond_to do |format|\n format.html { redirect_to @organization }\n format.xml { head :ok }\n end\n end",
"def destroy\n Organization.find(params[:id]).destroy\n flash[:success] = \"Organization deleted\"\n redirect_to search_organizations_path\n end",
"def destroy\n @independent = @member.independents.find(params[:id])\n @independent.destroy\n\n respond_to do |format|\n format.html { redirect_to(member_independents_url(@member)) }\n format.xml { head :ok }\n end\n end",
"def remove_organization_member(org, username)\n boolean_request :delete, \"/orgs/#{org}/members/#{username}\"\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.deleted = true\n @member.save\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lab_membership = LabMembership.find(params[:id])\n @user = @lab_membership.user\n @lab_membership.destroy\n\n respond_to do |format|\n format.html { redirect_to( user_lab_memberships_path(@user) ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to(organizations_url) }\n end\n end",
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n logger.info(\"#{Time.now} Se elimina el miembro ##{@member.id}!\")\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alliance_member = AllianceMember.find(params[:id])\n @alliance_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(alliance_members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member_info = MemberInfo.find(params[:id])\n @member_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(member_infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n flash[:notice] = \"Destroyed user\"\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n flash[:notice] = \"Destroyed user\"\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization_membershipship = current_person.organization_memberships.find(params[:id])\n @organization_membershipship.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_organization_memberships_path(current_person)) }\n format.js { render :nothing => true }\n format.xml { head :ok }\n end\n end",
"def destroy\n @people_organization.destroy\n respond_to do |format|\n format.html { redirect_to people_organizations_url, notice: 'People organization was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n end",
"def destroy\n standard_destroy(OrganizationType, params[:id])\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Организация успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to current_user }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @external_organization = ExternalOrganization.find(params[:id])\n @external_organization.destroy\n\n respond_to do |format|\n format.html { redirect_to external_organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n begin\n @organization.destroy\n rescue Exception => e\n flash[:alert] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to admin_organizations_path }\n format.json { head :no_content }\n end\n end",
"def delete(config, org_guid)\n token = @client.token\n\n user_setup_obj = UsersSetup.new(config)\n admin_token = user_setup_obj.get_admin_token\n\n # elevate user just to delete organization\n @client.token = admin_token\n org = @client.organization(org_guid)\n deleted = org.delete(:recursive => true)\n\n # then put token back to the initial one\n @client.token = token\n deleted\n end",
"def destroy\n @user = @person.user\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @family_member = FamilyMember.find(params[:id])\n @family_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(family_family_members_url(@current_family)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n respond_with @organization\n end",
"def destroy\n @organization = Organization.find(params[:id])\n @organization.destroy\n respond_with(@organization)\n end",
"def destroy\n @os_groups_membership.destroy\n respond_to do |format|\n format.html { redirect_to os_groups_memberships_url, notice: 'Os groups membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_organization.destroy\n respond_to do |format|\n format.html { redirect_to user_organizations_url, notice: 'User organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! @organization\n @organization.destroy\n\n redirect_to root_path\n end",
"def destroy\n redirect_to :action => :index and return unless is_owner?\n for member in @group.members\n member.destroy\n end\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_with(@organization)\n end",
"def destroy\n @membership ||= Membership.find(params[:id])\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n unless current_user.try(:admin?)\n flash[:notice] = PERMISSION_DENIED\n redirect_to organization_path(params[:id]) and return false\n end\n @organization = Organization.find(params[:id])\n @organization.destroy\n\n redirect_to organizations_url\n end",
"def destroy\n @org = Organisation.find_by( id: params[\"id\"]).delete\n redirect_to root_url\n end",
"def destroy\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n @tree_node_ac_rights.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tree_node_tree_node_permissions_path }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy if @person.users.empty?\n \n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization.destroy\n render json: { success: \"Organization deleted successfully\" }, status: :ok\n end",
"def test_admin_can_delete_user\n count_before = User.count\n count_memberships = Membership.count\n @request.session[:user]=users(:quentin)\n delete :destroy, :id => users(:lonely_user), :format => 'xml'\n assert_response 200\n assert_response :success\n assert_equal count_before - 1, User.count\n assert_equal count_memberships - 1, Membership.count\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admins_organization.destroy\n respond_to do |format|\n format.html { redirect_to admins_organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to memberships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n the_org = @person.org_id\n the_name = @person.name\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to org_path(the_org), status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @position_member = PositionMember.find(params[:id])\n @position_member.destroy\n\n respond_to do |format|\n format.html { redirect_to(position_members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to current_org }\n format.json { render json: @organization }\n end\n end",
"def destroy\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url(@membership.site) }\n format.json { head :no_content }\n end\n end",
"def destroy\n check_privileges(:superadmin?, organisation_path(params[:id])); return if performed?\n @organisation = Organisation.friendly.find(params[:id])\n @organisation.destroy\n flash[:success] = \"Deleted #{@organisation.name}\"\n redirect_to organisations_path\n end",
"def destroy\n @organization_account = OrganizationAccount.find(params[:id])\n @organization_account.destroy\n\n respond_to do |format|\n format.html { redirect_to organization_accounts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @org = Org.from_param(params[:abbr])\r\n @org.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to orgs_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def delete_trust(xml) \n if current_user \n trust_root = xml.root.get_elements('TrustRoot').first.text \n unless trust_root.empty? \n @trust = current_user.trusts.find(:first, :conditions => ['trust_root = ?', trust_root]) \n if @trust \n @trust.destroy \n return render(:text => \"<Response>success</Response>\") \n end \n end \n end \n render :text => '<Response>trust root does not exist</Response>' \n end",
"def destroy\n @contact = @current_affiliate_group.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organ = Organ.find(params[:id])\n @organ.destroy\n\n respond_to do |format|\n format.html { redirect_to(organs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @campaign = Campaign.find(params[:id])\n @campaign.destroy\n\n respond_to do |format|\n format.html { redirect_to(orgadmin_campaigns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # TODO: refactor models so that externaluserdomain is in portal namespace?\n # @external_user_domain = Portal::ExternalUserDomain.find(params[:id])\n @external_user_domain = ExternalUserDomain.find(params[:id])\n @external_user_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_external_user_domains_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @membership.destroy\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Membership was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organization_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@family ||= Family.find(params[:id])\n @family.destroy\n respond_to do |format|\n format.html { redirect_to(families_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @organization.destroy\n respond_to do |format|\n format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.6949872",
"0.6871764",
"0.6822603",
"0.6811967",
"0.6749267",
"0.67403114",
"0.6714289",
"0.66457415",
"0.6617163",
"0.65640503",
"0.6556841",
"0.65170145",
"0.64911973",
"0.64828926",
"0.6474834",
"0.6467789",
"0.6467635",
"0.6449576",
"0.6449576",
"0.6449576",
"0.6449576",
"0.6431088",
"0.6398468",
"0.63705057",
"0.6364455",
"0.63628477",
"0.6360993",
"0.63547385",
"0.6351936",
"0.6346041",
"0.6333812",
"0.630211",
"0.62923086",
"0.6288187",
"0.62876743",
"0.62876743",
"0.6285855",
"0.6285855",
"0.6281016",
"0.62679243",
"0.624162",
"0.62353563",
"0.6225466",
"0.6212038",
"0.6206572",
"0.6202107",
"0.6197902",
"0.61966854",
"0.6195505",
"0.6193786",
"0.61851364",
"0.61848617",
"0.617714",
"0.617714",
"0.617714",
"0.6175606",
"0.6174791",
"0.6161593",
"0.6157816",
"0.61454284",
"0.6145135",
"0.61445105",
"0.61430377",
"0.61356395",
"0.61343545",
"0.6133383",
"0.6121189",
"0.61185056",
"0.61131805",
"0.6111922",
"0.611039",
"0.61088777",
"0.6106763",
"0.610444",
"0.610444",
"0.6093879",
"0.60922325",
"0.60892683",
"0.6086925",
"0.6085504",
"0.6082203",
"0.608084",
"0.6079549",
"0.6075277",
"0.6073525",
"0.6057145",
"0.60565364",
"0.6054875",
"0.6052162",
"0.6046259",
"0.60446554",
"0.6037433",
"0.6028484",
"0.6020601",
"0.6020601",
"0.6020601",
"0.6020601",
"0.6020601",
"0.6020601",
"0.6020601"
] | 0.75160503 | 0 |
def authorize_admin! moved to the application_controller.rb | def find_category
@category = Category.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash[:alert] = "The category you were looking for could not be found."
redirect_to categories_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_admin!\n authorize! :manage, :all\n end",
"def authorize_admin!\n\t\tredirect_to new_admin_session_path unless current_admin\n\tend",
"def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end",
"def admin_authorize\n unless admin?\n unauthorized_access\n end\n end",
"def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end",
"def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend",
"def authorize\n unless admin?\n flash[:error] = \"unauthorized access\"\n redirect_to home_path\n false\n end\n end",
"def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end",
"def authorize_admin\n redirect_to root_path, flash: {:error => \"User don't have admin privileges\"} unless isAdmin?\n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end",
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end",
"def authorize_admin!\n unless current_user && current_user.admin?\n # session[:redirected_from] = request.original_url\n redirect_to signin_path, error: 'You need to sign in'\n end\n end",
"def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end",
"def authorize_as_admin\n create_admin_user\n login_into_alchemy\n end",
"def authorize_admin\n authorize! :update, convention.events.new\n end",
"def only_authorize_admin!\n authorize!(is?(:admin))\n end",
"def show\n authorize @admin\n end",
"def w000thenticate_admin!\n check_token\n authenticate_user!\n raise AbstractController::ActionNotFound unless current_user.admin?\n end",
"def show\n # authorize Admin\n end",
"def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end",
"def authorize?\n unless admin?\n flash[:error] = \"unauthorized access\"\n redirect_to 'root' \n false\n end\n end",
"def authorize\n end",
"def authorize\n end",
"def authorize_as_admin\n raise(ExceptionHandler::AuthenticationError, Message.unauthorized) unless !current_user.nil? && current_user.is_admin?\n end",
"def authorize_admin\n if user = User.find_by_id(session[:user_id])\n unless user.role == \"admin\"\n redirect_to login_url, :notice => \"You don't have permissions to view this page\"\n end\n end\n end",
"def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end",
"def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end",
"def authorize_as_admin\n if current_user.nil?\n head :unauthorized\n elsif !current_user.is_admin?\n render json: { status: 200, msg: 'You do not have permission to delete this!!!' }\n end\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def authenticate_admin!\n access_denied! unless current_user.admin?\n end",
"def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend",
"def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def authenticate_admin!\n current_user.is_admin? \n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def authorize_user\n\t if !current_user.admin_user? then\n\t redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n\t end\n\tend",
"def require_admin\n end",
"def check_admin\n if not ensure_admin\n redirect_to root_url, alert: \"you are not authorized\"\n end # end if\n end",
"def authenticate_spraycan\n authorize! :admin, Spraycan::ViewOverride\n end",
"def authorize_as_admin\n unless session[:administrator]\n redirect_to(:controller => \"portfolio\", :action => \"default\", :id => session[:username])\n end\n end",
"def show\n authorize! :read, @admin_system_admin\n end",
"def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end",
"def authorization; end",
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def authenticate_admin!\n unless current_user.admin?\n flash[:danger] = \"Sorry, you don't have premissions for this action.\"\n redirect_to root_path\n else\n true\n end\n end",
"def authorise_admin\n redirect_to root_path, alert: \"You are not authorised to access that page\" if current_user.try(:admin?) != true\n end",
"def superadmin_authenticate\n authorize current_user, :superadmin?\n end",
"def authorize\n if !current_user.has_role? :admin\n render plain:\"No access for you!\"\n end\n end",
"def authorize_user\n if !current_user.admin_user? then\n redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n end\n end",
"def authorize_user\n if !current_user.admin_user? then\n redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n end\n end",
"def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end",
"def authorize\n if !current_user.has_role? :admin\n render text:\"No Access For You!!!\"\n end\n end",
"def authenticate_admin!\n render_404 unless current_user.try(:admin?) && current_user\n end",
"def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end",
"def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end",
"def authenticate_admin\n unless current_user.admin?\n redirect_to site_path, alert: 'You do not have permission to access that page.' and return\n end\n end",
"def pre_authorize_cb; end",
"def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end",
"def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end",
"def authorize?(user)\n user && user.admin?\n end",
"def check_admin_authentication\n if session[:user] and is_admin?\n return true\n end\n # call overwriteable reaction to unauthorized access\n access_denied\n return false \n # unless session[:user] and is_admin?\n # session[:intended_action] = action_name\n # session[:intended_controller] = '/admin/' + controller_name\n # session[:intended_id] = params[:id]\n # flash[:error] = 'You must be logged in as an administrator to access this resource.'\n # redirect_to :controller => '/account', :action => 'login'\n # end\n end",
"def verify_admin\n render_401 unless current_user.is_admin?\n end",
"def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def index\n @admins = Admin.order(:email)\n authorize @admins\n end",
"def check_admin_permissions\n if !@current_user.has_role?(:backend)\n redirect_to root_path\n end\n end",
"def require_admin!\n # return if current token found and active\n return if current_admin\n\n # render error\n respond_with_error :unauthorized, I18n.t('not_authorized')\n end",
"def admin_logic\n end",
"def authorize_users\n authorize :user\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"def authenticate_admin_user!\n raise SecurityError unless current_user.is_admin \n end",
"def authenticate_admin\n if current_user and current_user.scope == 'admin'\n return true\n end\n flash[:error] = 'Adminだけ、この機能使える!'\n redirect_to root_path\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def handle_admin_permissions()\n if !session[:debater].is_admin\n redirect_to(:controller => :debater, :action => :login_form, :message => \"must login as admin to make specified request\")\n return false\n end\n return true\n end",
"def show\n authorize! :create, Administrator\n end",
"def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end",
"def facility_admin\n facility_controller_check\n unless current_user.role == \"site_admin\" || (@facility_role_access.present? && current_user.role == \"facility_admin\")\n flash[:error] = 'You are not authorized. Please request access from your manager'\n redirect_to root_url\n end\n end",
"def admin\n authorize! :admin, @listings\n end",
"def admin_auth\n\t\tif signed_out?\n deny_access \"You must sign in first.\"\t\t\t\n\t\telse\n\t deny_access \"You must be an admin to perform that action.\" unless current_user.admin\n\t\tend\n end",
"def authorize_user\n if @user.nil? and not current_user.is_a? AdminUser\n # TODO check if we can rewrite the URL and scope the resources\n # only for the current_user, instead of redirecting\n redirect_to root_url\n end\n end",
"def authenticate_admin\n if !admin_is_signed_in?\n raise ActionController::RoutingError.new('Not Found')\n end\n # deny_access if !admin_is_signed_in?\n end",
"def authorize\n if !session[:user_id]\n redirect_to root_path\n end\n if session[:user_id]\n if User.find_by(id: session[:user_id]).access != \"admin\"\n redirect_to root_path\n end\n end\n end",
"def authenticate_admin\n unless current_user.admin?\n redirect_to merge_default_redirect_params(site_path, scpbr: params[:scpbr]), alert: 'You do not have permission to access that page.' and return\n end\n end",
"def authenticate_admin\n unless current_user.admin?\n redirect_to merge_default_redirect_params(site_path, scpbr: params[:scpbr]), alert: 'You do not have permission to access that page.' and return\n end\n end"
] | [
"0.8515709",
"0.8243337",
"0.8220527",
"0.8193776",
"0.81304234",
"0.81297755",
"0.8115923",
"0.81037736",
"0.8059716",
"0.80376774",
"0.80376774",
"0.8033159",
"0.80266744",
"0.800083",
"0.800083",
"0.79551643",
"0.7944633",
"0.790711",
"0.78918475",
"0.7884879",
"0.78638023",
"0.78586674",
"0.782474",
"0.774274",
"0.76990414",
"0.7625799",
"0.7616814",
"0.75997317",
"0.75401825",
"0.74430305",
"0.7437217",
"0.74363434",
"0.7429465",
"0.7403651",
"0.7403651",
"0.7340062",
"0.72921675",
"0.72666216",
"0.7262552",
"0.7229669",
"0.7228623",
"0.7198335",
"0.71717286",
"0.716582",
"0.7129352",
"0.7123843",
"0.71168983",
"0.7111387",
"0.7101034",
"0.7077949",
"0.70623296",
"0.7054214",
"0.7053572",
"0.70522183",
"0.7044915",
"0.7037554",
"0.7025715",
"0.7015142",
"0.7014511",
"0.7012634",
"0.7012634",
"0.70071876",
"0.70026684",
"0.6996573",
"0.69952255",
"0.69890696",
"0.6988942",
"0.69713205",
"0.69652605",
"0.6964595",
"0.69572425",
"0.69497097",
"0.6949429",
"0.6936148",
"0.6921667",
"0.6921667",
"0.6921045",
"0.6920977",
"0.69145674",
"0.69121593",
"0.69086295",
"0.6898382",
"0.68979084",
"0.6890332",
"0.6887774",
"0.6887424",
"0.6885591",
"0.6883798",
"0.6883798",
"0.6883798",
"0.6882865",
"0.6881381",
"0.6874037",
"0.687295",
"0.6869473",
"0.686588",
"0.6851408",
"0.68452746",
"0.6838681",
"0.6836576",
"0.6836576"
] | 0.0 | -1 |
Check how many customers are going to watch a certain film | def find_number_of_customers
sql = "SELECT customers.*
FROM customers
INNER JOIN tickets
ON tickets.customer_id = customers.id
WHERE film_id = $1"
values = [@id]
customers_array = SqlRunner.run(sql, values)
customer_objects = customers_array.count
return customer_objects
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_of_customers_watching_film()\n sql = \"SELECT COUNT(*) FROM customers INNER JOIN tickets ON customers.id = tickets.cust_id WHERE tickets.film_id = $1\"\n # sql = \"SELECT COUNT(*) FROM tickets where film_id = $1\"\n values = [@id]\n cust_count = SqlRunner.run(sql, values)\n return cust_count[0]['count'].to_i\n end",
"def number_of_tickets_bought() # working in terminal - console (eg.: customer1.number_of_tickets_bought)\n return films.count\n end",
"def tickets_purchased\n return film().count\n end",
"def how_many_films()\n sql = \"SELECT films.* FROM films INNER JOIN tickets ON\n films.id = tickets.film_id WHERE tickets.customer_id = $1;\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = Film.map_films(films).count\n end",
"def number_of_customers()\n sql = 'SELECT title, SUM(CASE WHEN customer_id is NULL then 0 else 1 END) FROM tickets FULL OUTER JOIN screenings on tickets.screening_id = screenings.id FULL OUTER JOIN films on screenings.film_id = films.id WHERE films.id = $1 group by films.title'\n values = [@id]\n result = SqlRunner.run(sql, values)[0]['sum'].to_i\n end",
"def number_of_films()\n sql = \"SELECT * FROM tickets where customer_id = $1\"\n values = [@id]\n ticket_data = SqlRunner.run(sql, values)\n return ticket_data.count\n end",
"def capacity_check(film)\n if film.num_customers_in_film < @capacity\n return \"tickets available\"\n else\n return \"this showing is full\"\n end\n end",
"def tickets()\n return films().count()\n end",
"def count_tickets()\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets ON\n tickets.film_id = films.id\n WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, values)\n result = films.map{|film| Film.new(film)}\n return result.count\n end",
"def num_movies_of_theater\n self.movies.count\n end",
"def show\n\t\t@adminfilm = Film.find(params[:id])\n \t@reviewAmount = Filmreview.where(film_id: @adminfilm).count\n\tend",
"def customer_count\n sql = \"SELECT c.* FROM customers c INNER JOIN tickets t ON t.customer_id = c.id WHERE t.film_id = #{@id};\"\n customers = SqlRunner.run(sql)\n return customers.count\nend",
"def how_many_customers?()\n customers_booked = customers()\n return customers.length()\n end",
"def how_many_films()\n return have_ticket_for_which_films().size()\n end",
"def moviesCount\n Movie.count\n end",
"def count_customers\n return customers().length\n end",
"def counting_recommendation\n count = @shoe.count\n if count <= 1\n @cold\n elsif count <= 10\n @warm\n else\n @hot\n end\n end",
"def num_of_tickets()\n result = films()\n @number_of_tickets = result.count\n end",
"def customers_count()\n return customers().length()\n end",
"def customer_pet_count(customer)\n return customer[:pets].count()\n # return customer[:pets].length()\n # return customer[:pets].size()\n end",
"def movies_checked_out_count\n self.rentals.where(checked_out: true).count\n end",
"def customer_pet_count(customers)\n return customers[:pets].count()\nend",
"def check_train_wagons\n passenger_trains_amount = 0\n cargo_amount = 0\n @trains.each_value do |train|\n train.type == 'cargo' ? cargo_amount += 1 : passenger_trains_amount += 1\n end\n passenger_matches(passenger_trains_amount) || cargo_matches(cargo_amount)\n end",
"def num_doctors\n doctors.count\n end",
"def count_drinks_customer()\n @drinks.count\n end",
"def customer_pet_count(supplied_customer)\n return supplied_customer[:pets].length\nend",
"def customer_pet_count(customer)\n return customer[:pets].count()\nend",
"def all_customers_alt() # Read film1.all_customers_alt\n sql = \"SELECT COUNT(id) FROM tickets WHERE film_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)\n count_hash = result[0]\n return count_hash['count']\n end",
"def food_count()\nreturn @stomach.count()\nend",
"def user_mosnters_count\n self.monsters.count < TOTAL_MONSTERS\n end",
"def num_of_customers\n total_customers = self.customers\n return total_customers.size\n end",
"def showtimes(movie)\n self.showings.select do |showing|\n showing.movie == movie\n end\n end",
"def num_of_seats_available\n self.movie.capacity > self.movie.seats_sold ? (self.movie.seats_sold += 1) : false\n self.movie.save\n end",
"def movie_appearances\n movies.length\n end",
"def customer_pet_count(customer)\n customer[:pets].length()\nend",
"def count_scorable_city_reviews \n # Below - Collects all the scorable reviews to count for the city\n city_reviews = self.city_reviews.select do |review| \n review.is_scorable_review? == true\n end \n return city_reviews.count\n end",
"def num_of_customers()\n customers.size\nend",
"def number_of_documents_from_caseflow\n count = Document.where(file_number: veteran_file_number).size\n (count != 0) ? count : number_of_documents\n end",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def get_number_of_watchers(title)\n page_info_get_val(title, 'watchers', 'watchers')\n end",
"def busiest_john_travolta_years\n MovieDatabase.execute(<<-SQL)\n SELECT\n movies.yr, count(*) AS 'count'\n FROM\n movies\n JOIN actors ON castings.actor_id = actors.id\n JOIN castings ON castings.movie_id = movies.id\n WHERE\n actors.name = 'John Travolta'\n GROUP BY\n movies.yr\n HAVING\n count(*) > 2 \nSQL\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count (customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n customer[:pets].count\nend",
"def tickets()\n sql = \"SELECT * FROM tickets WHERE film_id = $1;\"\n values = [@id]\n tickets = SqlRunner.run(sql, values)\n return Ticket.map_items(tickets).count\n end",
"def customer_count()\n customers().count()\nend",
"def total_movies\n search_by_text('всего фильмов').to_i\n end",
"def can_afford_to_rent?(movie)\n end",
"def ticket_count()\n return self.booked_films.count\n end",
"def busiest_john_travolta_years\n MovieDatabase.execute(<<-SQL)\n SELECT\n m.yr, COUNT(*) AS count\n FROM\n movie m \n JOIN\n casting c ON m.id = c.movieid\n JOIN\n actor a ON a.id = c.actorid\n WHERE\n a.name = 'John Travolta'\n GROUP BY\n m.yr\n HAVING\n COUNT(*)>2;\nSQL\nend",
"def number_of_creaters(login=nil)\n count_by_frbr(login, :is_created_by, :how_many_roles?) \n end",
"def number_of_performers(login=nil)\n count_by_frbr(login, :is_performed_by, :how_many_roles?) \n end",
"def number_of_performers(login=nil)\n count_by_frbr(login, :is_performed_by, :how_many_roles?) \n end",
"def twenty_roles\n MovieDatabase.execute(<<-SQL)\n select actor.name\n from movie\n join casting on movie.id = casting.movieid\n join actor on casting.actorid = actor.id\n where ord = 1\n group by actor.name\n having count(movie.id) = 20\n SQL\nend",
"def tickets()\n sql = \"SELECT tickets.* FROM films INNER JOIN screenings ON films.id = screenings.film_id INNER JOIN tickets ON screenings.id = tickets.screening_id WHERE film_id = $1;\"\n values = [@id]\n films_hash = SqlRunner.run(sql, values)\n return Film.map_films(films_hash).count\n end",
"def customers_for_film()\n sql = \"SELECT name FROM customers\n INNER JOIN tickets ON customers.id = tickets.customer_id\n WHERE film_id = $1 ORDER BY name\"\n values = [@id]\n customer_data = SqlRunner.run(sql, values)\n return Customer.map_items(customer_data)\n end",
"def number_of_presenters(login=nil)\n count_by_frbr(login, :is_presented_by, :how_many_roles?) \n end",
"def number_of_presenters(login=nil)\n count_by_frbr(login, :is_presented_by, :how_many_roles?) \n end",
"def how_much_coffee(events)\n\tcoffee_count = 0\n\tevents.each do |event|\n\t\tnext unless event =~ /^(cw|dog|cat|movie)$/i \n\t\t# /(hello|world)/i #=> или \"hello\", или \"world\". Причём независимо от регистра\n\t\tcoffee_count += 1 if event == event.downcase\n\t\tcoffee_count += 2 if event == event.upcase\n\t\treturn \"You need extra sleep\" if coffee_count > 3\n\tend\n\treturn coffee_count\nend",
"def tickets_bought()\n tickets_array = films()\n number_of_tickets = tickets_array.count\n return \"#{@name} has bought #{number_of_tickets} tickets.\"\n end",
"def test_customer_pet_count\n count = customer_pet_count(@customers[0])\n assert_equal(0, count)\n end",
"def count_scorable_department_reviews \n # Below - Collects all the scorable reviews to count for the city\n department_reviews = self.department_reviews.select do |review| \n review.is_scorable_review? == true\n end \n return department_reviews.count\n end",
"def tickets_per_screening()\n sql = \"SELECT t.* FROM tickets t INNER JOIN films f ON t.film_id=f.id INNER JOIN screenings s ON s.film_id=f.id WHERE s.id = #{@id};\"\n shows_array = SqlRunner.run(sql)\n result = shows_array.map {|show| Screening.new(show)}\n fin_result = result.length()\n return fin_result\n end",
"def number_of_senator\n\ta = Legislator.where(\"title=?\",\"Sen\")\n\tputs \"Senators:\" +\"#{a.count}\"\nend",
"def total_visit\n pet_histories.count\n end",
"def viewers(m, set=@trainingSet)\n (set.data.select {|item| item[@MOVIE_ID].to_i == m}).collect {|item| item[@USER_ID].to_i}\n end",
"def total_no_of_customers()\n @@no_of_customers += 1\n puts \"Total number of customers: #@@no_of_customers\"\n end",
"def fitness_count\n find_user.activities.where(category: \"Health & Fitness\").where(accomplished: true).count\n end",
"def count(category)\n count = 0\n self.votes.each do |v|\n if v.category == category\n count+=1\n end\n end\n count\n end",
"def number_of_recorders(login=nil)\n count_by_frbr(login, :is_recorded_by, :how_many_roles?) \n end",
"def run(character)\n \tnumberOfFilms = 0\n \tfor name in get_character_names\n numberOfFilms += 1 if name == character\n \tend\n\t\t numberOfFilms\n end",
"def total_no_of_customers()\n @@no_of_customers += 1\n puts \"Total number of customers: #@@no_of_customers\"\n end",
"def get_num_staff_needed\n time_loc = user_choice_of_object_in_class(TimeSlot)\n puts \"You will need #{time_loc.num_staff_needed} staff for that time.\"\n analyze_menu\n end",
"def winner_count\n end",
"def count\n @monkeys.count\n end",
"def viewers(movie)\n\t\tmovie = movie.to_s\n\t\treturn @movie_user_index[movie]\t\n\tend",
"def seats_waitlisted_same_user_same_tour\n waitlist_same_user_same_tour ? waitlist_same_user_same_tour.num_seats : 0\n end",
"def tickets_bought\n sql = \"SELECT COUNT(*)\n FROM tickets\n WHERE tickets.customer_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)[0][\"count\"].to_i\n end",
"def number_of_reviews\n self.reviews.count\n end",
"def test_movie_actor\n movie = Movie.find( movies(:king_kong).id )\n naomi = Person.find( people(:naomi_watts).id )\n assert movie.actors.collect{ |c| c.person }.include?( naomi )\n end",
"def check_buyer_frequency\n month_ago = (self.day_of_month - 1.month)\n frequency = Appointment\n .where(['day_of_month > ? AND day_of_month <= ?', month_ago, self.day_of_month])\n .where(:buyer => self.buyer).count\n\n errors.add(:buyer, \"#{:buyer} has paid to many times this month\") unless frequency < 3\n\n end",
"def team_member_count\n self.teams.count < TOTAL_TEAMS\n end",
"def spicy_count\n self.spicies.size\n end",
"def watch(movie)\n if self.genres_enjoyed.member?(movie.genre)\n puts \"#{self.name} is watching #{movie.title}\"\n else\n puts \"I am not watching #{movie.title}\"\n end\n end",
"def customer_pet_count(number)\n return number[:pets].count\nend",
"def get_clients_count\n User.where(\"role = ?\", \"Client\").count \n end",
"def total_flights\n approved_flights.count\n end",
"def gross_for_director(director_data)\n total = 0\n movies = director_data[:movies]\n movies.length.times do |movie_idx|\n total+=movies[movie_idx][:worldwide_gross]\n end\n return total\nend",
"def vehicle_count(req)\n @vehicle_count ||= vehicle_dao.count(dealership(req))\n end",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].count\nend",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend",
"def which_watch(flight_length, movie_times)\n # we don't want brute force\n # assume there is a way to do this with O(n) given the last comment\n # we are not going to put this into anything and it doesn't really seem like a sorting problem\n # brute force is O(n) +\n\n times = {}\n movie_times.each_with_index do |movie, index|\n times[movie] = [flight_length - movie, index]\n end\n\n movie_times.each_with_index do |movie, index|\n movie, i = times[times[movie].first]\n return true if movie && i != index\n end\n\n return false\nend",
"def w_vs_m\n\t\tweightlifting = reviews.where(weightlifting_focus: true).count\n metcon = reviews.where(metcon_focus: true).count\n \n if weightlifting == 0 && metcon == 0\n @focus = \"\"\n elsif weightlifting > metcon\n @focus = \"This gym focuses on weightlifting\"\n elsif metcon > weightlifting\n @focus = \"This gym focuses on metcon training\"\n else \n @focus = \"This gym offers a balance of weightlifting and metcon training\"\n end \n return @focus\n end",
"def reviews_count\n \tobject.reviews.count\n end",
"def rent(movie)\n end",
"def dinosaurii_count\n @@count += 1\n end",
"def number_of_distinctions_offered(login=nil)\n\t\tcount_by_frbr(login, :presents, :how_many_distinctions?) \n\t end"
] | [
"0.7794894",
"0.70957434",
"0.70247567",
"0.67497456",
"0.6717541",
"0.67093766",
"0.6619023",
"0.6522943",
"0.64883494",
"0.6468304",
"0.6445455",
"0.63128936",
"0.63000375",
"0.6277315",
"0.62704754",
"0.6237113",
"0.6143318",
"0.610342",
"0.6099987",
"0.6081092",
"0.60318685",
"0.59940904",
"0.5980974",
"0.5961804",
"0.59406716",
"0.59210247",
"0.59166723",
"0.5895973",
"0.5893828",
"0.58797485",
"0.5849703",
"0.5848195",
"0.58294845",
"0.5827079",
"0.58206815",
"0.58110076",
"0.580746",
"0.5805338",
"0.5797732",
"0.5797732",
"0.57806545",
"0.5766214",
"0.5756277",
"0.5756277",
"0.5732851",
"0.57287526",
"0.57285035",
"0.57152414",
"0.57129556",
"0.5705662",
"0.568255",
"0.56803316",
"0.56797564",
"0.5644758",
"0.56335914",
"0.5633473",
"0.5630671",
"0.56227326",
"0.55941415",
"0.55608547",
"0.55608547",
"0.5522791",
"0.5517785",
"0.5516888",
"0.5513733",
"0.5511328",
"0.5492596",
"0.5475949",
"0.5474288",
"0.5472117",
"0.5468687",
"0.5459094",
"0.5452492",
"0.54453135",
"0.5444867",
"0.54385185",
"0.54261446",
"0.5423531",
"0.5419758",
"0.5419179",
"0.5413469",
"0.54132986",
"0.5410498",
"0.54099774",
"0.539375",
"0.5381464",
"0.53806806",
"0.53696597",
"0.5361085",
"0.53553146",
"0.5353105",
"0.53478146",
"0.53474784",
"0.5338714",
"0.53202766",
"0.53167504",
"0.5316704",
"0.5315048",
"0.53070897",
"0.5304878"
] | 0.67893517 | 3 |
speak method that will print "Ho, ho, ho! Haaaappy holidays!" | def speak
puts "Ho, ho, ho! Haaaappy holidays!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speak\n\t\t\tputs \"#{@name} said Ho, ho, ho! Haaaappy holidays!\"\n\t\tend",
"def speak\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\n\t\tputs \"\"\n\tend",
"def speak\r\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\r\n\tend",
"def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def speak\n\t\tputs \"Haaaappy holidays!! Ho, ho, ho!\"\n\tend",
"def speak\r\n puts \"Ho, ho, ho! Haaappy holidays!\"\r\n end",
"def speak()\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def speak\n \tputs \"Ho, Ho, Ho! Haaaaaappy holidays!\"\n end",
"def speak\n p \"Ho, ho, ho! Haaaappy holidays!\"\n end",
"def speak\r\n\t\tputs \"Ho, ho, ho! Merry Christmas and Haaaappy holidays to all!\"\r\n\tend",
"def speak\r\n puts \"Ho, ho, ho! Haaaappy holidays!\"\r\n puts \"\"\r\n end",
"def speak\r\n\t\t# Prints holiday greeting\r\n\t\tputs \"Ho, ho, ho! Haaaappy holidays!\"\r\n\tend",
"def Speak\r\n\t\tputs \"Ho, ho, ho! Haaappy holidays!\"\r\n\tend",
"def speak\n print \"Ho, ho, ho! Haaaappy holidays!\"\nend",
"def speak(holidays)\n\t\t\tp \"ho, ho, ho! Haaapy #{holidays}!\"\n\tend",
"def speak\n puts \"Ho, ho, ho! Haaaaappy holidays! I'm #{@name}!\"\n end",
"def speak\n puts \"Ho Ho Ho! Haaaaaappy holidays! from #{@name} Santa\"\n end",
"def speak(number_of_times)\n\t\tindex = 0\n\t\tuntil number_of_times == index \n\t\t\tputs \"Ho, ho, ho!, Haaaappy holidays!\"\n\t\t\tindex +=1\n\t\tend \n\tend",
"def speak\n puts \"ho, ho, ho! happy hollandaise!\"\n end",
"def speak\n \"#{name} says Assalaam alaykum\"\n end",
"def speak\n \"#{name} says arf!\"\n end",
"def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend",
"def speak\n \"#{@name} says Arf!!\"\n end",
"def say_happy_birthday_to(name)\n puts \"Happy Birthday #{name}!\"\nend",
"def speak\n \"#{@name} says arf!\"\n end",
"def speak\n \"#{@name} says arf!\"\n end",
"def speak\n \"#{name} says arf!\"\n end",
"def speak\r\n \"#{name} say Arf!\"\r\n end",
"def speak\n \"#{name} says Arf!\"\n end",
"def speak\n \"#{@name} says Arf!\"\n end",
"def speak\n \"#{name} says wuff!\"\n end",
"def speak\n\t\tputs \"My name is #{@name}. I am a #{@colour} dog. I am #{@age} years old and live in #{@home}\"\n\tend",
"def mothers_day\n puts \"Happy Mother's Day, Mom!\"\nend",
"def speak \n \"#{self.name} says arf!\"\n end",
"def speak\n puts \"WOOF WOOF\"\n end",
"def speak\n \"#{self.name} says arf!\"\n end",
"def speak\n \"#{name} says arf!\"\nend",
"def speak\n \"#{name} says arf!\"\nend",
"def speak\n \"#{name} says arf!\"\nend",
"def show_lose\n puts \"Uh oh... #{@name}... I think he's dead...\"\n puts 'You need to do better next time!'\n puts \"\\n\"\n end",
"def speak\n puts 'bark bark bark'\n end",
"def greeting(time)\n\t\"It's already #{day_of_the_week(time)}! Time to slay the day!\"\nend",
"def say_hello\t\t\t\t\t\n puts \"Dire Bonjour peut sauver des meres !\" \t\t#Petite référence à VALD\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend",
"def greet time=\"afternoon\", name=\"dear visitor\"\n puts \"Good #{time}, #{name}!\"\nend",
"def say something\n puts dude_format something\n end",
"def happy_birthday(birthday_kids)\n puts \"Happy Birthday Timmy! You are now 9 years old!\\nHappy Birthday Sarah! You are now 6 years old!\\nHappy Birthday Amanda! You are now 27 years old!\\n\"\nend",
"def greetings\n if @awake\n \"Hi, my name is #{full_name}\"\n else\n 'ZZZzzzZZZzzz'\n end\n end",
"def speak\n puts \"I am #{@name} and I am a #{@job}\"\n end",
"def speak\n puts \"woof\"\n end",
"def throw_fierce_lqqks\n 'Here I am, giving you Soviet-Satellite realness'\n end",
"def speak\n puts \"I'm a person\"\n end",
"def yell\n \"Who's the boss? I'm the boss!\"\n end",
"def speak\n #\"#{@name} says arf!\"\n #\"#{name} says arf!\"\n \"#{self.name} says arf!\"\n end",
"def say_name\n puts \"Bellossom!\"\n end",
"def speak\n \"#{@name} says Arf!\" # using instance variables in methods\n end",
"def essay_writer(title, topic, date, thesis_statement, pronoun)\r\n\tputs \"#{title}\"\r\n\tputs \"\"\r\n\tif \"#{pronoun}\" == \"male\"\r\n\t\tputs \"#{topic} was an important person in #{date}. He did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"female\"\r\n\t\tputs \"#{topic} was an important person in #{date}. She did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"thing\"\r\n\t\tputs\"#{topic} was an important object in #{date}. One of the most important discoveries to date. #{thesis_statement}\"\r\n\telse pronoun == \"place\"\r\n\t\tputs\"#{topic} was an important place in #{date}. An important place in our world of history. #{thesis_statement}\"\r\nend\r\n\r\nend",
"def make_sentence(name, sport)\n puts \"Did you know #{name} likes to play #{sport}\"\nend",
"def travel(domestic, foreign)\n puts \"In the US, I would like to travel to \" + domestic + \" and abroad I'd like to visit \" + foreign + \"!\"\nend",
"def says (opinion)\n puts \"#{name} says #{opinion}\"\n end",
"def greet(name,time_of_day)\n return \"Good #{ time_of_day} , #{name.capitalize()}\"\n\nend",
"def sayGoodnightTo(name)\n result = \"Goodnight, #{name}!\"\nend",
"def greeting(morning_or_noon, name, time)\n puts \"#{morning_or_noon} #{name}, nice to meet ya. Today is #{time}!\"\nend",
"def essay_writer(title, name, major_accomplishment, year_of_accomplishment, thesis, pronoun)\n\tputs \"Final Assignment Essay:\\n #{title}\n\t\\n\n\t#{date_of_accomplishment} was the year of #{name}. #{major_accomplishment.capitalize},\n\tdoes that ring a bell? That was all thanks to #{name}. \\n \n\t#{thesis} \\n\n\tMuch more could be said of #{name}. #{pronoun.capitalize} is somebody worth remembering. \n\t\"\n\t\nend",
"def goodbye \nputs \"see you tomorrow for more Makeup :)\"\nend",
"def sayMessage\r\n puts \"Hey Programmers!\"\r\n puts \"What's for lunch?\"\r\nend",
"def say(narrative)\n run(%Q`say \"#{escape_dq(narrative)}\"`) unless ENV['SHHH']\n end",
"def joke1\n puts \"A peanut was walking down the street. He was a-salt-ed.\"\nend",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def greet(folks); \"Hi, #{folks}!\"; end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def hail_the_king\n\tputs \"hail king mark\"\nend",
"def hail_the_king\n\tputs \"hail king mark\"\nend",
"def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end",
"def say(words)\n\tputs words + '.' ## <= We only make the change here!\nend",
"def love(mom, dad)\n puts \"#{mom} #{dad}, The End.\"\nend",
"def make_toast(toast)\n if @hired == true\n puts \"you are making #{toast}ed toast.\"\n else\n puts \"you are fired, and you can't cook.\"\n end\n end",
"def getspeechtext( date,bmr,input,activity,deficit )\n # Will return a written version of the calory calculation\n\n speechtext=\"\";\n today=false;\n is_was=\"was\";\n have_did=\"did\";\n record_ed=\"record\";\n\n today = false; \n\n if date == Date.current\n speechtext=\"Today, \";\n today=true;\n is_was=\"is\";\n have_did=\"have\"\n record_ed=\"recorded\"\n elsif date == Date.current - 1 \n speechtext=\"Yesterday, \"\n elsif date == Date.current - 7\n speechtext=\"Last week, \"\n else\n #Will say the day\n speechtext = \"On \" + date.strftime(\"%A\") + \", \" \n end\n\n if bmr > 0 \n speechtext += \"Your resting calorie requirement \" + is_was + \" \" + bmr.to_s + \" calories. \"\n end \n\n if input == 0 && activity == 0\n speechtext = speechtext + \"You \" + have_did + \" not \" + record_ed + \" any food, drinks or activities. \"\n end\n\n if input == 0 && activity != 0\n speechtext = speechtext + \"You \" + have_did + \" not \" + record_ed + \" any food or drinks. \"\n elsif input != 0\n speechtext = speechtext + \"Your food and drink intake \" + is_was + \" \" + input.to_s + \" calories. \" \n end\n\n if activity == 0 && input != 0\n speechtext = speechtext + \"You \" + have_did + \" not \" + record_ed + \" any activities. \"\n elsif activity != 0\n speechtext = speechtext + \"You burnt \" + activity.to_s + \" calories through exercise. \"\n end\n\n\n if (deficit > (bmr*0.05)) && (input > 0 || activity > 0)\n if today \n speechtext = speechtext + \"You need to burn off \" + deficit.to_s + \" calories, if you want to maintain your current weight. \"\n else\n speechtext = speechtext + \"Your intake was \" + deficit.to_s + \" calories greater than you needed, possibly leading to weight gain.\"\n end \n elsif (deficit < (0-(bmr*0.05))) && (input > 0 || activity > 0)\n if today \n speechtext = speechtext + \"You can eat or drink \" + (0-deficit).to_s + \" calories more, and maintain your current weight.\"\n else \n speechtext = speechtext + \"You burnt \" + (0-deficit).to_s + \" calories more than you needed, possibly leading to weight loss. \"\n end \n end\n\n if input>0 && activity>0\n speechtext = speechtext + \" Well done using Evos, your health pal. \"\n else \n speechtext = speechtext + \" To get the best out of me, please do make sure you use me every day.\" \n end\n\n speechtext\n\n end",
"def say_something(something)\n puts \"#{something}, said Becca\"\nend",
"def greet time, name\n puts \"Good #{time}, #{name}!\"\nend",
"def say_goodnight(name)\r\n \"Dobranoc #{ name.capitalize }\"\r\nend",
"def sayHi\n\t\tputs(greet)\n\tend",
"def say(statement = '')\n ui.say statement\n end",
"def say_goodbye\r\n goodbye = \"Thanks for playing the Virtual Crazy 8-Ball game!\\n\\n\" +\r\n \"By Corey Hicks\\n\" +\r\n \"https://www.bruin.bellevue.edu\"\r\n puts goodbye\r\n end",
"def greeting\nputs \"HELLO, BONJOUR, HOLA, GUTENTAG, HALLO, HOWDY, NAMASKAR, MERHABA\"\nend",
"def speak\n\t`say 'I am a product.`\nend",
"def say text\n @output.say text\n end",
"def say_goodbye\r\n\t\tgoodbye = \"Thanks for playing the Virtual Crazy 8-Ball game! \\n\\n\" +\r\n\t\t\"Student: T. J. Flesher \\n\\nhttp://www.bellevue.edu/\"\t\t\r\n\t\tputs goodbye\r\n\tend",
"def calling_speak\n speak\n end",
"def say_name\n puts \"Bonsly!\"\n end",
"def say_hi \n expression = \"I am a genius\"\n puts expression\n end"
] | [
"0.8913485",
"0.88735366",
"0.886438",
"0.88444173",
"0.88444173",
"0.88426083",
"0.88049465",
"0.8800241",
"0.8755356",
"0.8687648",
"0.8672491",
"0.8610019",
"0.8605874",
"0.85283035",
"0.8523174",
"0.84836096",
"0.8398543",
"0.826154",
"0.72503704",
"0.7047539",
"0.7021355",
"0.69369",
"0.69075304",
"0.6880135",
"0.6876169",
"0.6862654",
"0.6862654",
"0.6860483",
"0.6818122",
"0.68040276",
"0.67997366",
"0.6787642",
"0.6769971",
"0.676346",
"0.67359996",
"0.67210215",
"0.6677026",
"0.6633522",
"0.6633522",
"0.6633522",
"0.6614394",
"0.6537354",
"0.6529691",
"0.6507122",
"0.65046304",
"0.65046304",
"0.65046304",
"0.65046304",
"0.65046304",
"0.65046304",
"0.6492758",
"0.64578557",
"0.6415735",
"0.6412059",
"0.64091414",
"0.6370653",
"0.6343989",
"0.6338338",
"0.6328049",
"0.6288594",
"0.62853366",
"0.62736136",
"0.6264005",
"0.62603635",
"0.6255086",
"0.62545687",
"0.62531114",
"0.6228918",
"0.62228185",
"0.62143755",
"0.6196228",
"0.6194067",
"0.6187167",
"0.617253",
"0.6171416",
"0.6169021",
"0.6165834",
"0.6163682",
"0.6161",
"0.6161",
"0.6137822",
"0.6136451",
"0.6135339",
"0.6131012",
"0.61218876",
"0.61202246",
"0.6117695",
"0.6113311",
"0.61111933",
"0.610571",
"0.6103435",
"0.6103284",
"0.60947263",
"0.60937774",
"0.609095",
"0.60869324",
"0.60866314",
"0.6086033"
] | 0.89317626 | 2 |
eat_milk_and_cookies methodtakes a cookie type (example: "snickerdoodle") as a parameter and prints "That was a good !" | def eat_milk_and_cookies(cookie)
puts "That was a good #{cookie} cookie!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eat_milk_and_cookies(cookie_type)\n puts \"that was a good #{cookie_type}!\"\n end",
"def eat_milk_and_cookies(cookie_type)\n puts \"That was a good #{cookie_type} cookie!\"\n end",
"def eat_milk_and_cookies(cookie_type)\r\n\t\tputs \"That was a good #{cookie_type}\"\r\n\tend",
"def eat_milk_and_cookies(cookie_type)\n\t\tputs \"That was a good #{cookie_type}!\"\n\tend",
"def eat_milk_and_cookies(cookie)\r\n\t\t# Takes in a type of cookie as a parameter\r\n\t\t# Prints the cookie in a sentence\r\n\t\tputs \"That was a good #{cookie}! The milk was delicious too!\"\r\n\tend",
"def eat_milk_and_cookies(cookie_type = \"\")\r\n p \"That was a good #{cookie_type}!\"\r\n end",
"def eat_milk_and_cookies(cookie_flavor)\n #Prints \"That was a good <type of cookie here>!\"\n puts \"That was a good #{cookie_flavor} cookie!\"\n end",
"def eat_milk_and_cookies(cookie)\n puts \"That was a good #{cookie} cookie!\"\n end",
"def eat_milk_and_cookies(cookie)\r\n\t\tputs \"That was a good #{cookie} here!\"\r\n\tend",
"def eat_milk_and_cookies(cookie)\n\t\tputs \"That was a good #{cookie}!\"\n\tend",
"def eat_milk_and_cookies(cookie)\r\n\t\tputs \"That was a good #{cookie}! may I have another?\"\r\n\tend",
"def eat_milk_and_cookies(cookie)\n\t\tp \"That was a good #{cookie} cookie!\" \n\tend",
"def eat_milk_and_cookies\n puts \" What kind of cookie you have?\"\n cookie = gets.chomp\n \n puts \"That was a good #{cookie}!\"\n end",
"def eat_milk_and_cookies(cookie)\n\t\tputs \"That was a good #{cookie}!\"\n\t\tputs \"\"\n\tend",
"def eat_milk_and_cookies(cookie)\n p \"That was a good #{cookie}!\"\n end",
"def eat_milk_and_cookies(cookie)\n p \"That was a good #{cookie} cookie!\"\n end",
"def eat_milk_and_cookies(cookie)\n\t\t\tputs \"While at the brewery in #{@location} they ate a good #{cookie}. #{@name} exclaimed, 'These are the best #{cookie}s in #{@location}!'\"\n\t\tend",
"def eat_milk_and_cookies(cookie)\r\n puts \"That was a good #{cookie}\"\r\n puts \"\"\r\n end",
"def eat_milk_and_cookies(cookie)\n print \"That was a good #{cookie}\"\nend",
"def cookie(x)\n name = \"\"\n if x.is_a?(String)\n name = \"Zach!\"\n elsif x.is_a?(Numeric)\n name = \"Monica!\"\n else\n name = \"the dog!\"\n end\n\n \"Who ate the last cookie? It was \" + name\nend",
"def eat_milk_and_cookies\n if Random.rand(5) == 0\n p \"MMMMM #{@name} just ate an Chocolatechip Cookie\"\n elsif Random.rand(5)== 1\n p \"MMMMM #{@name} just ate an Snickerdoodle Cookie\"\n elsif Random.rand(5) == 2\n p \"MMMMM #{@name} just ate an Oreo Cookie\"\n elsif Random.rand(5) == 3\n p \"MMMMM #{@name} just ate an Sugar Cookie\"\n else\n p \"MMMMM #{@name} just ate an Almond Cookie\"\n end\n end",
"def eat\n \"Eating the cookie\"\n end",
"def cookies_and_milk(cookies, milk)\n puts \"I've got #{cookies} cookies!\"\n puts \"I've got #{milk} glasses of milk.\"\n puts \"Too bad milk is gross...\"\nend",
"def bake\n \"Baking the cookie\"\n end",
"def show_cookies\n if request.post? || params[:who] == 'peter'\n ls = cookies[LIFESIZE_COOKIE]\n if ls\n @cookie_value = JSON.pretty_generate(JSON.parse(Crypt.decrypt(ls)))\n else\n @cookie_value = \"lifesize cookie not set\"\n end\n @screen_cookie_value = cookies[SCREEN_COOKIE] ? cookies[SCREEN_COOKIE] : \"Screen cookie not set\"\n render :show_cookies\n else\n render :noaccess\n end\n end",
"def cookie_named(name); end",
"def details\n \"This cookie has #{@sugar}g of sugar and #{@flour}g of flour.\"\n end",
"def favourite_drink name\r\n\tif name == \"Jean-Luc\"\r\n\t\t\"tea, Earl Grey, hot\"\r\n\telsif name == \"Kathryn\"\r\n\t\t\"coffee, black\"\r\n\telse\r\n\t\t\"perhaps...horchata?\"\r\n\tend\r\nend",
"def cooking\n \"Grab the butter, we're about to be cookin.\"\nend",
"def store(fortune_cookie_text)\n hash = msg(fortune_cookie_text)\n puts \"Stored cookie: #{fortune_cookie_text}\"\n puts \"Cookie ID: #{hash}\"\n return hash\n end",
"def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend",
"def captain_obvious(name, what_you_love)\n\tputs(\"My name is #{name} and I love #{what_you_love}!\")\nend",
"def details\n puts \"This cookie has #{@sugar_amount}g of sugar and #{@flour_amount}g of flour\"\n end",
"def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend",
"def fortune_cookie; end",
"def favorites_parrot(thing1, thing2, thing3)\n \"I love #{thing1} too! I love #{thing2} too! I love #{thing3} too!\"\nend",
"def exploit\r\n if datastore['RAILSVERSION'] == 3\r\n cookie = rails_3\r\n elsif datastore['RAILSVERSION'] == 4\r\n cookie = rails_4\r\n end\r\n cookie_name = datastore['COOKIE_NAME']\r\n\r\n print_status(\"Checking for cookie #{datastore['COOKIE_NAME']}\")\r\n res = send_request_cgi({\r\n 'uri' => datastore['TARGETURI'] || \"/\",\r\n 'method' => datastore['HTTP_METHOD'],\r\n }, 25)\r\n if res && res.headers['Set-Cookie']\r\n match = res.headers['Set-Cookie'].match(/([_A-Za-z0-9]+)=([A-Za-z0-9%]*)--([0-9A-Fa-f]+); /)\r\n end\r\n\r\n if match\r\n if match[1] == datastore['COOKIE_NAME']\r\n print_status(\"Found cookie, now checking for proper SECRET\")\r\n else\r\n print_status(\"Adjusting cookie name to #{match[1]}\")\r\n cookie_name = match[1]\r\n end\r\n\r\n if check_secret(match[2],match[3])\r\n print_good(\"SECRET matches! Sending exploit payload\")\r\n else\r\n fail_with(Exploit::Failure::BadConfig, \"SECRET does not match\")\r\n end\r\n else\r\n print_warning(\"Caution: Cookie not found, maybe you need to adjust TARGETURI\")\r\n if cookie_name.nil? || cookie_name.empty?\r\n # This prevents trying to send busted cookies with no name\r\n fail_with(Exploit::Failure::BadConfig, \"No cookie found and no name given\")\r\n end\r\n if datastore['VALIDATE_COOKIE']\r\n fail_with(Exploit::Failure::BadConfig, \"COOKIE not validated, unset VALIDATE_COOKIE to send the payload anyway\")\r\n else\r\n print_status(\"Trying to leverage default controller without cookie confirmation.\")\r\n end\r\n end\r\n\r\n print_status \"Sending cookie #{cookie_name}\"\r\n res = send_request_cgi({\r\n 'uri' => datastore['TARGETURI'] || \"/\",\r\n 'method' => datastore['HTTP_METHOD'],\r\n 'headers' => {'Cookie' => cookie_name+\"=\"+ cookie},\r\n }, 25)\r\n\r\n handler\r\n end",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def cookie_baking (time, high_altitude)\n if (high_altitude > 5000 && (time < 15 && time >= 12))\n puts \"At your altitude of #{high_altitude}, you will need to add 1 tbsp of flour and 3 tsp of water for your recipe!\\n\"\n elsif (high_altitude < 5000 && (time < 15 && time >= 12))\n puts \"At your altitude of #{high_altitude}, you will need to add 1 tbsp of flour and 3 tsp of water for your recipe!\\n\"\n puts \"Your cookies will turn out perfect if you cook it for about #{time} minutes!\\n\"\n elsif (high_altitude > 5000 && time < 12)\n puts \"At your altitude of #{high_altitude}, you will need to add 1 tbsp of flour and 3 tsp of water for your recipe!\"\n puts \"You need to cook your cookies longer than #{time} minutes or they will be uncooked!\\n\"\n elsif (high_altitude > 5000 && time > 15)\n puts \"At your altitude of #{high_altitude}, you will need to add 1 tbsp of flour and 3 tsp of water for your recipe!\"\n puts \"If you cook your cookies for #{time} minutes you will end up burning them!\\n\"\n elsif (high_altitude < 5000 && time < 12)\n puts \"At your altitude of #{high_altitude} feet, you will not have to add any extra ingredients or change your baking time to ensure a good cookie!\"\n puts \"You need to cook your cookies longer than #{time} minutes or they will be uncooked!\\n\"\n elsif (high_altitude < 5000 && time > 15)\n puts \"At your altitude of #{high_altitude} feet, you will not have to add any extra ingredients or change your baking time to ensure a good cookie!\"\n puts \"If you cook your cookies for #{time} minutes you will end up burning them!\\n\"\n else\n puts \"If you do not know your cooking times or altitude, look them up on google!\\n\"\n end\nend",
"def meow\n puts \"My name is #{@name.capitalize} and I love eating #{@preferred_food} at #{eats_at}\"\n end",
"def whos_your_sidekick(sidekick)\n if sidekick == \"Robin\"\n say \"#{sidekick}: Holy rusted metal, Batman!\"\n elsif sidekick == \"Batgirl\"\n say \"#{sidekick}: Suit me up, Uncle Alfred.\"\n else\n say \"Fine, I'll pick one for you.\"\n sidekick = \"Robin\"\n end\n\n sidekick\nend",
"def test_cookie_has_sugar_set_method\n # Given: A cookie with 6g of Sugar and 15g of Butter\n c=Cookie.new(6,15)\n # When\n c.sugar= 10\n # Then\n assert_equal(c.sugar,10)\n end",
"def cookies(cookies); end",
"def breakfast(food=\"oatmeal\")\n \"The most important meal of the day could always be #{food}!\"\nend",
"def render_cookies\n @cookies.keys.sort.each do |flavor|\n count = @cookies[flavor]\n\n Cookies::CookieUtils.instance.\n render_cookies(flavor, count)\n end\n end",
"def meow()\n punctuations = '.!?'\n \"#{CAT_FACES[rand(CAT_FACES.length)]} Meow#{punctuations[rand(punctuations.length)]}\"\n end",
"def meow\r\n\t\t# output: prints string of # of meows based on talkative-ness\r\n\t\t\t# IF mild (1 to 3) , meows once\r\n\t\t\tputs \"meowww\" if (1..3).include?(@meowiness)\r\n\t\t\t# IF medium (4 to 6), meows 3 times\r\n\t\t\t3.times { print \"meowww \"} if (4..6).include?(@meowiness)\r\n\t\t\t# IF high (7 to 8), meows 5 times,\r\n\t\t\t5.times { print \"meowwww \" } if (7..8).include?(@meowiness)\r\n\t\t\t# IF really high (9 to 10), meows 5 times, CAPS\r\n\t\t\t5.times { print \"meowwww \".upcase } if (9..10).include?(@meowiness)\r\n\t\tend",
"def breakfast(cereal=\"frosted flakes\")\n \"Morning is the best time for #{cereal}!\"\nend",
"def make_juice(juice)\n if @hired == true\n puts \"you are serving #{juice} juice.\"\n else\n puts \"you are fired, and you can't serve.\"\n end\n end",
"def meat\n 'Beef'\n end",
"def meal_choice(meat = \"meat\")\n puts \"what kind of #{meat} would you like?\"\nend",
"def adopted_cats(dumb_friends_league, from_friend, stray_cat)\n puts \"I have adopted #{dumb_friends_league} cat(s) from Dumb Friends League.\"\n puts \"I have adopted #{from_friend} cat(s) from a friend.\"\n puts \"I have adopted #{stray_cat} stray cat(s).\"\nend",
"def meow\n puts \"My name is #{@name} and I eat #{@preferred_food} at #{eats_at}.\"\n end",
"def my_favorite_animal\n \"cat\"\nend",
"def test_laptop_has_cookies\n end",
"def dance_to_music \n \"Feel the rhythm\"\n end",
"def meal_choice(name =\"meat\")\n puts \"The meal choice is #{name}!\"\nend",
"def favorite_food(name)\n formatted_name = name.capitalize\n\n return 'vindaloo' if formatted_name == 'Lister'\n return 'mashed potatoes' if formatted_name == 'Rimmer'\n\n 'hard to say...maybe fried plantain?'\nend",
"def meow\n \"Meow, I am a beautiful kitty\"\n end",
"def cats_favorite_food\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - See which type of food you'll to put out to attract a specific cat\" => 1,\n \" 2 - View all of the cats that prefer wet food\" => 2,\n \" 3 - View all of the cats that prefer dry food\" => 3,\n \" 4 - Return to the Main Menu\" => 4 }\n choice = prompt.select(\"\\nIf you're lonely and want a cat, here's the info you'll need to attract one!\\n\", choices, per_page: 4)\n case (choice.to_i)\n when 1\n puts \"\\nWhich cat would you like to attract?\"\n cat_food_name = gets.chomp\n cat_fav_food = Cat.find_by(name: cat_food_name).favorite_food\n puts \"\\n#{cat_food_name} prefers #{cat_fav_food} food.\"\n when 2\n puts \"\\nCats that prefer wet food:\"\n Cat.where(:favorite_food => \"wet\").select {|cat| puts cat.name}\n when 3\n puts \"\\nCats that prefer dry food:\"\n Cat.where(:favorite_food => \"dry\").select {|cat| puts cat.name}\n when 4\n main_menu\n end\n end",
"def quotes \n case self\n when 'thunderstorm'\n puts \"Fucking thunder storm..\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue)\n when 'thunderstorm with light rain'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with rain'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue)\n when 'thunderstorm with heavy rain'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'light thunderstorm'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'ragged thunderstorm'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with light drizzle'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with drizzle'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'light thunderstorm'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue) \n when 'thunderstorm with heavy drizzle'\n puts \"Fucking thunder storm...\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to sing the “Fuck you Thunderâ€.\".colorize(:blue)\n when 'drizzle'\n puts \"Meh... Just stay in bed.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can browse Tumblr & play Angrybirds.\".colorize(:blue)\n when 'light intensity drizzle'\n puts \"Global fucking warming\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Yeah, let's blame Global Warming.\".colorize(:blue)\n when 'heavy intensity drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can look outside to get more information.\".colorize(:blue)\n when 'light intensity drizzle rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can look outside to get more information.\".colorize(:blue)\n when 'drizzle rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'heavy intensity drizzle rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'shower rain and drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'heavy shower rain and drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'shower drizzle'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'light rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue)\n when 'moderate rain'\n puts \"Get your fucking umbrella\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Shitloads of rain is awaiting you\".colorize(:blue)\n when 'heavy intensity rain'\n puts \"It rains cats and dogs.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You better get an umbrella my friend.\".colorize(:blue) \n when 'very heavy rain'\n puts \"It's fucking raining.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can look outside to get more information.\".colorize(:blue) \n when 'extreme rain'\n puts \"Shitloads of rain is awaiting you\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You better get an umbrella my friend.\".colorize(:blue)\n when 'freezing rain'\n puts \"Fucking brain freeze.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Fuck Yeah Ice Cream!\".colorize(:blue)\n when 'light intensity shower rain'\n puts \"Get your fucking umbrella\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Shitloads of rain is awaiting you.\".colorize(:blue) \n when 'shower rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Shitloads of rain is awaiting you.\".colorize(:blue) \n when 'heavy intensity shower rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue) \n when 'ragged shower rain'\n puts \"You better get an umbrella my friend.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It rains cats and dogs.\".colorize(:blue) \n when 'snow'\n puts \"Holy fucking snow.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Still not ready for building that fucking snow castle.\".colorize(:blue)\n when 'light snow'\n puts \"Are you freezing fucking serious?\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can't look outside because of fucking snow.\".colorize(:blue)\n when 'heavy snow'\n puts \"Can't see because fucking snow.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Try looking outside for more information, try it...\".colorize(:blue)\n when 'sleet'\n puts \"Cold as fucking shit..\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You heard it, unpack your space heater!\".colorize(:blue)\n when 'light shower sleet'\n puts \"It's getting|fucking chilly.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You heard it, unpack your space heater!\".colorize(:blue)\n when 'shower sleet'\n puts \"Frozen fucking fingers.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Can't feel my fingers any more.\".colorize(:blue)\n when 'light rain and snow'\n puts \"North fucking pole.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Nothing against the north pole, but seriously!\".colorize(:blue)\n when 'rain and snow'\n puts \"Icebergs all over your shit..\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Time to get cozy and watch Titanic again!.\".colorize(:blue)\n when 'light shower snow'\n puts \"Fucking ice age.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The movie was great, the weather is not.\".colorize(:blue)\n when 'shower snow'\n puts \"Hello? yes, this is snow-man.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's time to build me. Look outside fancy pants.\".colorize(:blue)\n when 'heavy shower snow'\n puts \"It's fucking skiing time.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Snow every where, yay!\".colorize(:blue)\n when 'overcast clouds'\n puts \"Cloudy with a chance of....\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You thought I would say meatballs right? Stupid.\".colorize(:blue)\n when 'few clouds'\n puts \"Meh...Just stayin bed.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"You can browse Tumblr & play Angrybirds.\".colorize(:blue)\n when 'scattered clouds'\n puts \"It’s likea meh…kinda day\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"But you can change it with a smile :) Or drugs.\".colorize(:blue)\n when 'broken clouds'\n puts \"Fucking fifty shades of grey\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Fucking grey clouds everywhere\".colorize(:blue)\n when 'clear sky'\n puts \"It's fucking tropical.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Ice Cream is my final answer.\".colorize(:blue)\n when 'mist'\n puts \"It's justfucking grey.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Just mist & no love, but computer games\".colorize(:blue)\n when 'smoke'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'haze'\n puts \"It's fucking cloudy.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'sand/ dust whirls'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'fog'\n puts \"It's fucking foggy.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's getting cold outside!\".colorize(:blue)\n when 'sand'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'dust'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'volcanic ash'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you\".colorize(:blue)\n when 'squalls'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'tornado'\n puts \"It's getting fucking dark.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"The storm is coming - May the Force be with you.\".colorize(:blue)\n when 'cold'\n puts \"Am I allowed to say nipples?\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"Because it's freezing! You get the point.\".colorize(:blue)\n when 'hot'\n puts \"So hot makin' me stoopid.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"I heard that Ryan Gosling said this.\".colorize(:blue)\n when 'windy'\n puts \"It's fucking windy.\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"It's getting cold outside!\".colorize(:blue)\n when 'hail'\n puts \"It's a wee bit nippy!\".bold.blink.colorize(:light_blue)\n puts ''\n puts \"This is for you my Scottish friends.\".colorize(:blue)\n else\n \"\\u{3F}\" \n end\n end",
"def meow\n puts \"My name is #{name} and i eat #{preferred_food} at #{eats_at}\"\n end",
"def meow\n return \"My name is #{@name} and I eat #{@preferred_food} at #{eats_at}\"\n end",
"def how_old_is_teddy(name=\"Teddy\")\n puts \"Whose age shall we proclaim today?\"\n name = gets.chomp\n puts \"#{name.capitalize} is #{rand(20..200)} years old!\"\nend",
"def drink_test(age, sex)\n if age >= 21\n response = \"You can drink\"\n elsif age > 18 or sex == \"female\"\n response = \"You can probably drink with fake id\"\n else\n response = \"You can't drink\"\n end\n return response\nend",
"def get_quote(person)\n case person\n when 'Yoda'\n 'Do. Or do not. There is no try.'\n when 'Confucius'\n 'I hear and I forget. I see and I remember. I do and I understand.'\n else\n 'Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.'\n end\nend",
"def meow\n \"My name is #{@name} and I eat #{@preferred_food} at #{eats_at}\"\n end",
"def favorites_parrot(favorite1, favorite2, favorite3)\n \"I love #{favorite1} too! I love #{favorite2} too! I love #{favorite3} too!\"\nend",
"def pets(dog = \"nevermind you don't have a dog\", cat = \"nevermind you don't have a cat\")\n puts \"Your dog's name is \" + dog + \", and your cat's name is \" + cat + \".\"\nend",
"def cook_sink_eat\n delay = 4\n refresh\n HowMuch.amount(6) if click_on 'Mix/Add Honey'\n sleep delay\n refresh\n HowMuch.amount(1) if click_on 'Mix/Add Coconut'\n\n sleep delay\n refresh\n click_on 'Cook'\n popup = PopupWindow.find\n popup.click_on 'OK' if popup\n sleep delay\n\n # Eat!\n refresh\n click_on 'Enjoy'\n sleep delay\n end",
"def meal(breakfast = \"frosted flakes\", lunch = \"grilled cheese\", dinner = \"salmon\")\n puts \"Morning is the best time for #{breakfast}!\"\n puts \"Noon is the best time for #{lunch}!\"\n puts \"Evening is the best time for #{dinner}!\"\nend",
"def rate_my_food(food)\n case food\n when \"Steak\"\n \"Pass the steak sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Pizza\"\n \"My favorite food\"\n when \"Tacos\", \"Burritos\", \"Quesadillas\"\n # o lo uno o lo otro\n \"Cheesy and filling!\"\n when \"Tofu\", \"Brussel Sprouts\"\n \"Disguisting!\"\n else\n \"I don't know about that food\"\n end\nend",
"def meal(food, drink)\n food = food.to_s\n drink = drink.to_s\n sentence = \"I like to eat \" + food + \" with a cup of \" + drink\n puts sentence\nend",
"def breakfast(food=\"Frosted flakes\")\n puts \"#{food} is a great meal for breakfast!\"\nend",
"def cook (item, cooking_time)\n puts \"fill a saucepan with water\"\n puts \"place saucepan on the stove\"\n puts \"bring saucepan to boil\"\n puts \"add #{item}\"\n puts \"cook for #{cooking_time} minutes\"\nend",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend",
"def rate_my_food(food)\n case food\n when 'Githeri'\n 'pass the pilipili'\n when 'Mukimo'\n 'pass the thukuma'\n when 'ngima', 'muchere', 'ngacii'\n 'pass maziwa mala'\n else\n 'Nilale njaa'\n end\nend",
"def drinks(coffee, tea)\n puts \"we have #{coffee} for coffees, and #{tea} for teas\"\n end",
"def rate_my_food(food)\n case food\n when \"Steak\" #if food is eq to Steak\n \"Pass the sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Tacos\", \"Burritos\", \"Strawhat\"\n \"That all is great\"\n when \"Tofu\", \"Brussels\"\n \"Yuck!\"\n else\n \"I dont know about this\"\n end\n\nend",
"def make_juice(juice)\n puts \"You want #{juice} juice.\"\n end",
"def american\n puts \"Let's explore the whiskies of the United States of America\"\n #call method to list whiskies for this particular type\n list_whiskies('c/33/american-whiskey?filter=true&rfdata=~size.76#productlist-filter')\n end",
"def breakfast(food=\"frosted flakes\")\n \"Morning is the best time for #{food}!\"\nend",
"def drink_coffee(cups=1)\n\t\tcups.times do\n\t\t\t@caffeine_level += rand(0..20)\n\t\tend\n\t\tputs \"#{@name} drank #{cups} cup(s) of coffee and has a caffeiene level of #{@caffeine_level}\"\n\t\tif @caffeine_level > 200\n\t\t\tputs \"#{@name} has reached caffeine critical mass.\"\n\t\telsif @caffeine_level > 100\n\t\t\tputs \"#{@name} is excited.\"\n\t\telse\n\t\t\tputs \"#{@name} could use a Redbull.\"\n\t\tend\n\tend",
"def shakil_the_dog\n prompt = \"> \"\n puts \"What do you want to say to Shakil?\"\n print prompt\n \n while say = gets.chomp\n case say\n when \"woof\"\n puts \"WOOF WOOF WOOF\"\n print prompt\n when \"SHAKIL STOP!\".downcase\n puts \"Shakil is silent\"\n print prompt\n when \"meow\"\n puts \"woof woof woof woof woof\"\n print prompt\n when /treat/\n puts \"Shakil is silent\"\n print prompt\n when \"go away\"\n puts \"Shakil has left the building\"\n break\n else\n puts \"woof\"\n print shakil_the_dog\nend\n end\nend",
"def get_quote(person)\n if person == 'Yoda'\n return 'Do. Or do not. There is no try.'\n end\n\n if person == 'Confucius'\n return 'I hear and I forget. I see and I remember. I do and I understand.'\n end\n\n if person == 'Einstein'\n return 'Do not worry about your difficulties in Mathematics. I can assure you mine are greater.'\n end\nend",
"def greet\n\t\treturn \"I'm #{GOODMOOD}. How are you?\"\n\tend",
"def mad_lib\n input = []\n categories = [\"Animal\", \"Colour\", \"Food\", \"Song\", \"Body Part\"]\n\n question = \"What's your favourite \"\n\n catnum = 0\n while input.length < 5\n puts \"#{question} \" + \"#{categories[catnum]}\"\n input << answer = gets.chomp\n catnum += 1\n end\n\n puts \"There was a strange little #{input[0]}.\"\n puts \"Their best friend in the whole wide world was feeling #{input[1]},\"\n puts \"on account of their tummy being upset by #{input[2]}.\"\n puts \"The #{input[0]} felt bad so decided to sing them #{input[3]}\"\n puts \"This made their #{input[4]} feel amazing.\"\nend",
"def get_cookie\n resp = @cookie\n if @atl_token != \"\"\n resp = resp + \"; atl.xsrf.token=#{@atl_token}\"\n end\n puts \"Using cookie: #{resp}\".yellow\n resp\n end",
"def get_quote(person)\n if person == 'Yoda'\n return 'Do. Or do not. There is no try.'\n end\n\n if person == 'Confucius'\n return 'I hear and I forget. I see and I remember. I do and I understand.'\n end\n\n if person == 'Einstein'\n return 'Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.'\n end\nend",
"def favorites_parrot (first, second, third)\n \"Your favorite things are #{first}, #{second}, and #{third}\"\nend",
"def explain3(options={})\n animal = options.fetch(:the) { \"cow\" }\n sound = options.fetch(:says){ \"moo\" }\n \"the #{animal} says #{sound}\"\nend",
"def soft_cheese(type, age=8)\n \"#{type}, aged #{age} months\"\nend"
] | [
"0.90104645",
"0.8914423",
"0.88889974",
"0.8843581",
"0.8667706",
"0.8539303",
"0.82648027",
"0.81688815",
"0.81081903",
"0.8104923",
"0.80679584",
"0.7929066",
"0.78308177",
"0.7790069",
"0.77713144",
"0.77375907",
"0.76591617",
"0.7638699",
"0.75196546",
"0.7192431",
"0.7016012",
"0.6768086",
"0.66694164",
"0.59185594",
"0.58376193",
"0.57986826",
"0.57450837",
"0.56782955",
"0.56602794",
"0.56464577",
"0.5643337",
"0.5641981",
"0.5627684",
"0.55878395",
"0.55086493",
"0.5503882",
"0.5483475",
"0.54640555",
"0.54640555",
"0.54584587",
"0.54511887",
"0.5439581",
"0.54359424",
"0.54319215",
"0.54081345",
"0.5376285",
"0.5355948",
"0.53550893",
"0.5350185",
"0.53482074",
"0.5325715",
"0.53072643",
"0.53018826",
"0.5300316",
"0.5279233",
"0.52740663",
"0.5262866",
"0.5255421",
"0.52517307",
"0.52493984",
"0.5238472",
"0.5237212",
"0.5237105",
"0.52181894",
"0.5205256",
"0.5199374",
"0.51914877",
"0.51755655",
"0.51712483",
"0.51542264",
"0.51418954",
"0.5141641",
"0.51366264",
"0.51250166",
"0.5124157",
"0.51173437",
"0.5116875",
"0.5116875",
"0.5116875",
"0.5116875",
"0.5116875",
"0.5116875",
"0.5116875",
"0.51127744",
"0.5109819",
"0.51060396",
"0.51042104",
"0.5099535",
"0.50953984",
"0.5093679",
"0.5092575",
"0.50907135",
"0.5087244",
"0.5086134",
"0.50857836",
"0.5085209",
"0.508138",
"0.5079716",
"0.50722826",
"0.50711375"
] | 0.8083686 | 10 |
GET /help_offers GET /help_offers.xml | def index
@help_offers = @job_request.help_offers
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @help_offers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @help_offer = HelpOffer.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def offers\n authenticated_post(\"offers\").body\n end",
"def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def show\n @local_offer = LocalOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @local_offer }\n end\n end",
"def show\n @product_offer = ProductOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_offer }\n end\n end",
"def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end",
"def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def show\n @voucher_offer = VoucherOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end",
"def show\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @breadcrumb = 'read'\n @sale_offer = SaleOffer.find(params[:id])\n @items = @sale_offer.sale_offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_offer }\n end\n end",
"def show\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def show\n @breadcrumb = 'read'\n @offer = Offer.find(params[:id])\n @items = @offer.offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def show\n @poll_option = PollOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poll_option }\n end\n end",
"def new\n @help_offer = @job_request.help_offers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def show\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def won_offers(options={})\n won_status.offers.all(options)\n end",
"def index\n @offers = Offer.all\n \n end",
"def show\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def index\n @help_items = HelpItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_items }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n @offer_quizzes = @offer.quizzes\n @offer_packages = @offer.packages\n @quizzes = Quiz.excluding(@offer.quizzes)\n @packages = Package.excluding(@offer.packages)\n @offer_users = @offer.offer_users\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helppage }\n end\n end",
"def offers; global.offers end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @general_offers = GeneralOffer.all\n end",
"def index\n @offers = Offer.all\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def show\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def show \n # @offer = Offer.find(params[:id])\nend",
"def show\n @ep = Ep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ep }\n end\n end",
"def index\n if backend_request?\n @shop_resource_offers = Shop::ResourceOffer.all\n else \n @shop_resource_offers = Shop::ResourceOffer.where([\"(started_at is null or started_at < ?) and (ends_at is null or ends_at > ?)\", Time.now, Time.now])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_resource_offers }\n end\n end",
"def show\n @volunteer_offering = VolunteerOffering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @volunteer_offering }\n end\n end",
"def show\n @help_item = HelpItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_item }\n end\n end",
"def show\n @rhelp = Rhelp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rhelp }\n end\n end",
"def index\n @auto_offers = AutoOffer.all\n end",
"def index\n if api_request?\n @shop_special_offers = Shop::SpecialOffer.buyable_by_character(current_character)\n else\n @shop_special_offers = Shop::SpecialOffer.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: include_root(@shop_special_offers, :special_offer) }\n end\n end",
"def show\n @need = Need.find(params[:id])\n @offer = current_user.offers.new if user_signed_in?\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @need }\n end\n end",
"def new\n @voucher_offer = VoucherOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end",
"def show\n @offer = Offer.find params[:id]\n render layout: nil\n end",
"def index\n @offers = Offer.search_offers(params[:keyword],\n params[:pick_up_point], params[:drop_off_point],\n params[:vancancy_lower_limit], params[:vancancy_upper_limit],\n params[:cost_lower_limit], params[:cost_upper_limit])\n end",
"def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end",
"def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end",
"def show\n \n @offering = Offering.find_by_id(params[:id])\n @resource = Resource.find @offering.resource_id\n @question = Question.new\n @negociation = Negociation.new\n @questions = @offering.questions\n @event = Event.find @offering.event_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end",
"def show\n @shop_special_offer = Shop::SpecialOffer.find_by_id(params[:id])\n raise NotFoundError.new('offer not found') if @shop_special_offer.nil?\n\n if api_request? && !current_character.purchases.where('external_offer_id = ? and redeemed_at is not null', @shop_special_offer.external_offer_id).empty?\n raise NotFoundError.new('offer not found')\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offer }\n end\n end",
"def index\n @peeps = Peep.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @peeps }\n end\n end",
"def show\n @helocapp = Helocapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helocapp }\n end\n end",
"def show\n respond_to do |format|\n format.html { render partial: 'show', layout: 'admin/admin_show' }\n format.xml { render xml: @poll_question.to_xml(include: :poll_options) }\n end\n end",
"def show\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accepted_offer }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @option }\n end\n end",
"def show\n @available_off = AvailableOff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @available_off }\n end\n end",
"def index\n @aid_offers = AidOffer.all\n end",
"def index\n @offerers = Offerer.all\n end",
"def serveOAI\n content_type 'text/xml;charset=utf-8'\n provider = EscholProvider.new\n provider.process_request(params)\n end",
"def show\n @public_offer = PublicOffer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public_offer }\n end\n end",
"def show\n offer = Offer.find params[:id]\n @offer = render_to_string partial: 'offers/offer.json', locals: { offer: offer }\n respond_to do |format|\n format.html { render layout: false }\n end\n end",
"def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end",
"def getOffers(root, xp=\"//xmlns:offer\", debug=true)\r\n\toffers = root.xpath(xp)\r\n\tif debug\r\n\t\tputs offers.count().to_s + \" nodes found\" \r\n\tend\r\n\treturn offers\r\nend",
"def index\n @special_offers = SpecialOffer.all\n end",
"def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def manage_offer\n @offer = @host.offers.find(params[:id])\n end",
"def show\n render json: @offer\n end",
"def show\n render json: @offer\n end",
"def show\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def scrape_offers_for(item)\n return [] unless valid_offers_url?(item.more_offers_url)\n root = Nokogiri::HTML(get_more_offers_page(item.more_offers_url))\n scraped_offers = scrape_offers(root)\n publish(:on_offers_scrapped_for, item, scraped_offers)\n scraped_offers\n end",
"def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def show\n @installation = Installation.find(params[:installation_id]) \n @offpost = Offpost.find(params[:id])\n @learn = @offpost.learns\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offpost }\n end\n end",
"def show\n @ticket_seller = TicketSeller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket_seller }\n end\n end",
"def show\n @helocagree = Helocagree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helocagree }\n end\n end",
"def test_offers\r\n get :offers, :id => 5072\r\n assert_response 301\r\n assert_redirected_to '/Ear-Force-X2-Wireless-Headphones-for-Xbox-reviews'\r\n end",
"def special_offer(special_offer, options = {})\n get(\"special_offers/#{special_offer}\", options).pop\n end",
"def show\n @estoques = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estoques }\n end\n end",
"def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end",
"def show\n @emoneyout = Emoneyout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @emoneyout }\n end\n end",
"def index\n @eversions = Eversion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eversions }\n end\n end",
"def index\n @offerte_regels = OfferteRegel.all\n end",
"def show\n @oai_endpoint = OaiEndpoint.find(params[:id])\n respond_to do |format|\n format.html { render :template => 'oai_endpoints/show', :layout => params[:layout] || true }\n format.json { render :json => @oai_endpoint.as_json }\n end\n end",
"def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def index\n @base_offer = BaseOffer.new\n @base_offers = BaseOffer.all\n end",
"def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end",
"def show\n @end_point = EndPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @end_point }\n format.xml { render xml: @end_point }\n end\n end",
"def get_qualified_offers(start = 0, stop = 100, sort = W3i::Sort::Default)\n data = {\n \"GetQualifiedOffersInputs\" => {\n \"OfferIndexStart\" => start,\n \"OfferIndexStop\" => stop,\n \"SortColumn\" => 0,\n \"SortDirection\" => sort\n }\n }\n raw_data = send_request('/PublicServices/AfppApiRestV1.svc/Offer/Qualified/Get', data)\n \n W3i::Offers.new(raw_data)\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def lost_offers(options={})\n lost_status.offers.all(options)\n end",
"def show\n @employee_demographic = EmployeeDemographic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employee_demographic }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tool_part }\n format.xml { render xml: @tool_part }\n end\n end"
] | [
"0.7353507",
"0.71887404",
"0.6827243",
"0.6684004",
"0.6613176",
"0.6536255",
"0.65061235",
"0.6483202",
"0.6443958",
"0.6406321",
"0.63508016",
"0.62746173",
"0.62746173",
"0.62746173",
"0.62746173",
"0.6256585",
"0.6256156",
"0.62473404",
"0.6231579",
"0.6227351",
"0.62242395",
"0.6206216",
"0.62002593",
"0.6198078",
"0.6182807",
"0.6176986",
"0.6176701",
"0.61652434",
"0.6135328",
"0.6119591",
"0.6099705",
"0.60682034",
"0.6058392",
"0.6036782",
"0.6032397",
"0.6021397",
"0.60177284",
"0.5997351",
"0.593847",
"0.5938224",
"0.59317064",
"0.5918261",
"0.59128845",
"0.588311",
"0.5881924",
"0.5877779",
"0.5872441",
"0.58459616",
"0.5836613",
"0.5836429",
"0.5832654",
"0.58224535",
"0.58181334",
"0.58162636",
"0.5813626",
"0.58132464",
"0.58097893",
"0.5809051",
"0.5799792",
"0.5786613",
"0.57816344",
"0.57738435",
"0.5766679",
"0.5765186",
"0.5764916",
"0.5746937",
"0.57270986",
"0.5727096",
"0.57248557",
"0.5715071",
"0.5713698",
"0.5707008",
"0.57040936",
"0.57040936",
"0.56995815",
"0.56989557",
"0.56928986",
"0.5690272",
"0.5680013",
"0.5680013",
"0.5676674",
"0.5674279",
"0.5664693",
"0.56640834",
"0.5653767",
"0.5652817",
"0.56482434",
"0.56467617",
"0.5643205",
"0.564216",
"0.5641089",
"0.56393784",
"0.56356114",
"0.56351554",
"0.56329805",
"0.5632356",
"0.56267506",
"0.5624838",
"0.56211853",
"0.5620333"
] | 0.75306696 | 0 |
GET /help_offers/1 GET /help_offers/1.xml | def show
@help_offer = HelpOffer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @help_offer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end",
"def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def show\n @local_offer = LocalOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @local_offer }\n end\n end",
"def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end",
"def show\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def show\n @voucher_offer = VoucherOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end",
"def show\n @product_offer = ProductOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_offer }\n end\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def show\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helppage }\n end\n end",
"def show\n @poll_option = PollOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poll_option }\n end\n end",
"def show\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def index\n @help_items = HelpItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_items }\n end\n end",
"def show\n @rhelp = Rhelp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rhelp }\n end\n end",
"def new\n @help_offer = @job_request.help_offers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def show\n @help_item = HelpItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_item }\n end\n end",
"def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end",
"def show\n @ep = Ep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ep }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def show\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def show\n @breadcrumb = 'read'\n @sale_offer = SaleOffer.find(params[:id])\n @items = @sale_offer.sale_offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_offer }\n end\n end",
"def show\n @breadcrumb = 'read'\n @offer = Offer.find(params[:id])\n @items = @offer.offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def offers\n authenticated_post(\"offers\").body\n end",
"def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def show\n @volunteer_offering = VolunteerOffering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @volunteer_offering }\n end\n end",
"def show\n @helocapp = Helocapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helocapp }\n end\n end",
"def index\n @peeps = Peep.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @peeps }\n end\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def show \n # @offer = Offer.find(params[:id])\nend",
"def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def new\n @voucher_offer = VoucherOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end",
"def disp_xml_rq\n body= File.open(\"public/OTA/OTA_HotelAvailRQ100.xml\").read\n render :xml => body\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def show\n @installation = Installation.find(params[:installation_id]) \n @offpost = Offpost.find(params[:id])\n @learn = @offpost.learns\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offpost }\n end\n end",
"def show\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def show\n @available_off = AvailableOff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @available_off }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @option }\n end\n end",
"def show\n @helpdb = Helpdb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helpdb }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def index\n @offers = Offer.all\n \n end",
"def show\n @power = Power.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n @offer_quizzes = @offer.quizzes\n @offer_packages = @offer.packages\n @quizzes = Quiz.excluding(@offer.quizzes)\n @packages = Package.excluding(@offer.packages)\n @offer_users = @offer.offer_users\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @offer = Offer.find params[:id]\n render layout: nil\n end",
"def show\n @helocagree = Helocagree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @helocagree }\n end\n end",
"def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def show\n @howto = Howto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @howto }\n end\n end",
"def serveOAI\n content_type 'text/xml;charset=utf-8'\n provider = EscholProvider.new\n provider.process_request(params)\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def show\n @need = Need.find(params[:id])\n @offer = current_user.offers.new if user_signed_in?\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @need }\n end\n end",
"def show\n @response = Response.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @response }\n end\n end",
"def show\n respond_to do |format|\n format.html { render partial: 'show', layout: 'admin/admin_show' }\n format.xml { render xml: @poll_question.to_xml(include: :poll_options) }\n end\n end",
"def show\n @product_exchange = ProductExchange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_exchange }\n end\n end",
"def show\n @website_use = WebsiteUse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @website_use }\n end\n end",
"def show\n @apparel = Apparel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @apparel }\n end\n end",
"def show\n @emoneyout = Emoneyout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @emoneyout }\n end\n end",
"def show\n @wrestler = Wrestler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wrestler }\n end\n end",
"def show\n \n @offering = Offering.find_by_id(params[:id])\n @resource = Resource.find @offering.resource_id\n @question = Question.new\n @negociation = Negociation.new\n @questions = @offering.questions\n @event = Event.find @offering.event_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end",
"def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tool_part }\n format.xml { render xml: @tool_part }\n end\n end",
"def index\n @general_offers = GeneralOffer.all\n end",
"def manage_offer\n @offer = @host.offers.find(params[:id])\n end",
"def show\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end",
"def show\n @oai_endpoint = OaiEndpoint.find(params[:id])\n respond_to do |format|\n format.html { render :template => 'oai_endpoints/show', :layout => params[:layout] || true }\n format.json { render :json => @oai_endpoint.as_json }\n end\n end",
"def show\n @estoques = Estoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estoques }\n end\n end",
"def show\n @ticket_seller = TicketSeller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket_seller }\n end\n end",
"def show\n @lottery = Lottery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lottery }\n end\n end",
"def show\n @exchange = Exchange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exchange }\n end\n end",
"def new\n @peep = Peep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def helps(id)\n helps_data(request(\"needs/helps/#{id}.xml\", :auth => true))\n end",
"def show\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_auto_option }\n end\n end",
"def show\n @employee_demographic = EmployeeDemographic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @employee_demographic }\n end\n end",
"def show\n @ms_offgrade = MsOffgrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ms_offgrade }\n end\n end",
"def show\n @entity_end_point_rel = EntityEndPointRel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity_end_point_rel }\n end\n end",
"def show\n @opt = Opt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @opt }\n end\n end",
"def show\n @mt_overhead_energy_data = MtOverheadEnergyData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mt_overhead_energy_data }\n end\n end",
"def show\n @catalogs_supply = Catalogs::Supply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogs_supply }\n end\n end",
"def index\n @eversions = Eversion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eversions }\n end\n end",
"def show\n @clicker = Clicker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clicker }\n end\n end",
"def new\n @offlearn = Offlearn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def index\n @page_title = \"Power Units\"\n @power_units = PowerUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @power_units }\n end\n end",
"def show\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def show\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def show\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measurement }\n end\n end",
"def index\n @product_exchanges = ProductExchange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_exchanges }\n end\n end",
"def show\n @lek = Lek.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lek }\n end\n end",
"def show\n @detailed_retrofit = DetailedRetrofit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @detailed_retrofit }\n end\n end",
"def show\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power_unit }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @seller_listing = SellerListing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seller_listing }\n end\n end",
"def show\n @end_point = EndPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @end_point }\n format.xml { render xml: @end_point }\n end\n end",
"def index\n if backend_request?\n @shop_resource_offers = Shop::ResourceOffer.all\n else \n @shop_resource_offers = Shop::ResourceOffer.where([\"(started_at is null or started_at < ?) and (ends_at is null or ends_at > ?)\", Time.now, Time.now])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_resource_offers }\n end\n end",
"def won_offers(options={})\n won_status.offers.all(options)\n end"
] | [
"0.74026746",
"0.6734518",
"0.6648982",
"0.65405214",
"0.6539314",
"0.6514852",
"0.6514299",
"0.6409339",
"0.6353402",
"0.63334846",
"0.63303894",
"0.6276926",
"0.62537545",
"0.6221384",
"0.6220917",
"0.6216229",
"0.61455727",
"0.6140602",
"0.6137569",
"0.6134753",
"0.61246204",
"0.6079206",
"0.6070237",
"0.60602003",
"0.60516864",
"0.6050172",
"0.6043262",
"0.60287845",
"0.5966724",
"0.5964033",
"0.5964033",
"0.5964033",
"0.5964033",
"0.596075",
"0.5960495",
"0.5951541",
"0.59376436",
"0.5935047",
"0.593223",
"0.5927427",
"0.5909853",
"0.5898222",
"0.5896698",
"0.5895851",
"0.5895604",
"0.5876735",
"0.58656985",
"0.58621174",
"0.5855422",
"0.58531433",
"0.58463275",
"0.58396596",
"0.5837962",
"0.5837217",
"0.5837217",
"0.5834861",
"0.58295983",
"0.5824973",
"0.5815779",
"0.5812967",
"0.5806704",
"0.58065647",
"0.5803401",
"0.5800454",
"0.5795188",
"0.5788079",
"0.5775793",
"0.5769631",
"0.57641315",
"0.5763646",
"0.5759025",
"0.57525843",
"0.5750921",
"0.5750306",
"0.57496965",
"0.57406014",
"0.574041",
"0.57396257",
"0.573805",
"0.5736346",
"0.5731733",
"0.57308346",
"0.5726298",
"0.5726146",
"0.572579",
"0.572082",
"0.57182854",
"0.5716223",
"0.571537",
"0.571537",
"0.57152826",
"0.5700786",
"0.56993526",
"0.56923664",
"0.56917757",
"0.5691522",
"0.5688889",
"0.56823784",
"0.5679762",
"0.5675993"
] | 0.7505168 | 0 |
GET /help_offers/new GET /help_offers/new.xml | def new
@help_offer = @job_request.help_offers.build
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @help_offer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @poll = Poll.new\n @poll.poll_options = PollOptions.new\n @title = \"Create a new poll\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end",
"def new\n @peep = Peep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def new\n @offlearn = Offlearn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def new\n @voucher_offer = VoucherOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end",
"def new\n @poll_option = PollOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll_option }\n end\n end",
"def new\n @offering = Offering.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @howto = Howto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @howto }\n end\n end",
"def new\n @volunteer_offering = VolunteerOffering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer_offering }\n end\n end",
"def new\n @rhelp = Rhelp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rhelp }\n end\n end",
"def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end",
"def new\n @helocapp = Helocapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @helocapp }\n end\n end",
"def new\n @echo = Echo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @echo }\n end\n end",
"def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @office = Office.new\n\t\t\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @office }\n end\n end",
"def new\n\t\t@clicker = Clicker.new\t\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicker }\n end\n end",
"def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hotel }\n end\n end",
"def new\n @hostel = Hostel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hostel }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool_part }\n format.xml { render xml: @tool_part }\n end\n end",
"def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def new\n @apparel = Apparel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @apparel }\n end\n end",
"def new\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lead }\n end\n end",
"def new\n @supplier = Supplier.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @supplier }\n end\n end",
"def new\n @add_on = AddOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_on }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n @estoques = Estoque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estoques }\n end\n end",
"def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @click_to_talk = ClickToTalk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @click_to_talk }\n end\n end",
"def new\n @web_location = WebLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @web_location }\n end\n end",
"def new\n @available_off = AvailableOff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @available_off }\n end\n end",
"def new\n @entity_end_point_rel = EntityEndPointRel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entity_end_point_rel }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @officer }\n end\n end",
"def new\n @pwebsite = Pwebsite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pwebsite }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def new\n @lottery = Lottery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lottery }\n end\n end",
"def new\n @clicker = Clicker.new\n\n \n respond_to do |format|\n \n format.html # new.html.erb\n \nformat.xml { render :xml => @clicker }\n \n end\n \nend",
"def new\n @price_list = PriceList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price_list }\n end\n end",
"def new\n @foyer = Foyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foyer }\n end\n end",
"def new\n @lek = Lek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lek }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @show }\n end\n end",
"def new\n @opt = Opt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opt }\n end\n end",
"def new\n @helpdb = Helpdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @helpdb }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new_rest\n @entry_answer = EntryAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_answer }\n end\n end",
"def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end",
"def new\n @olark = Olark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @olark }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end",
"def new\n @partner_link = PartnerLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partner_link }\n end\n end",
"def new\n @power = Power.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power }\n end\n end",
"def new\n @votereply = Votereply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @votereply }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @etd = Etd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @etd }\n end\n end",
"def new\n @lift = Lift.new\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lift }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @lote = Lote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lote }\n end\n end",
"def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end",
"def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @hops_addition = HopsAddition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hops_addition }\n end\n end",
"def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @product_exchange = ProductExchange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_exchange }\n end\n end",
"def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def new\n @shop_special_offer = Shop::SpecialOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offer }\n end\n end",
"def new\n @catalogs_supply = Catalogs::Supply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_supply }\n end\n end",
"def new\n @sellerring = Sellerring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sellerring }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @documentation = Documentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentation }\n end\n end",
"def new\n @engineer = Engineer.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @engineer }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end",
"def new\n @ticket_seller = TicketSeller.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ticket_seller }\n end\n end",
"def new\n @populate_feed_info = PopulateFeedInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @populate_feed_info }\n end\n end",
"def new\n @addbook = Addbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addbook }\n end\n end",
"def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end",
"def new\n @website = Website.new params[:website]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @website }\n end\n end",
"def new\n @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end",
"def new\n @upgrade = Upgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @upgrade }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end"
] | [
"0.74450016",
"0.72475255",
"0.71911746",
"0.7179016",
"0.7130969",
"0.7118919",
"0.7101198",
"0.7072075",
"0.70415676",
"0.69157916",
"0.68849903",
"0.68829316",
"0.68829316",
"0.68829316",
"0.6875253",
"0.6873888",
"0.68587524",
"0.68372023",
"0.68245935",
"0.6821307",
"0.6818919",
"0.6786762",
"0.67747253",
"0.67739075",
"0.6752808",
"0.6734298",
"0.67181814",
"0.67151326",
"0.6711392",
"0.67106813",
"0.67055315",
"0.67045534",
"0.67043024",
"0.67019624",
"0.67007136",
"0.66967475",
"0.66903824",
"0.66799283",
"0.6677136",
"0.6673807",
"0.66734475",
"0.6673002",
"0.6661306",
"0.66600895",
"0.6656967",
"0.6645789",
"0.664559",
"0.6640285",
"0.663637",
"0.6625287",
"0.6624754",
"0.66206074",
"0.66195375",
"0.6618781",
"0.6616112",
"0.66151386",
"0.6613007",
"0.66062075",
"0.6605764",
"0.6601675",
"0.6600089",
"0.659583",
"0.65931445",
"0.65906024",
"0.65901476",
"0.6588561",
"0.6588166",
"0.6586687",
"0.6583495",
"0.65805775",
"0.65770715",
"0.6576846",
"0.6576807",
"0.65763646",
"0.6570567",
"0.6570457",
"0.65699023",
"0.65681106",
"0.6562433",
"0.65609884",
"0.65591156",
"0.6559073",
"0.65581816",
"0.65573955",
"0.6556804",
"0.65516424",
"0.65516424",
"0.6550219",
"0.65495557",
"0.654469",
"0.6543362",
"0.6542453",
"0.65423524",
"0.6540076",
"0.6539669",
"0.65373355",
"0.6535821",
"0.65333027",
"0.6533114",
"0.65308124"
] | 0.72620726 | 1 |
POST /help_offers POST /help_offers.xml | def create
@help_offer = @job_request.help_offers.build(params[:help_offer])
@help_offer.user = current_user
respond_to do |format|
if @help_offer.save
flash[:notice] = 'Help Offer was submitted.'
format.html { redirect_to(job_request_url(@job_request)) }
format.xml { render :xml => @help_offer, :status => :created, :location => @help_offer }
else
format.html { render :action => "new" }
format.xml { render :xml => @help_offer.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def new\n @help_offer = @job_request.help_offers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def create_offer(options = {}, &block)\n options = set_options(options, &block)\n @response = post('offer', options)\n end",
"def create\n @offering = Offering.new(params[:offering])\n\n respond_to do |format|\n if @offering.save\n flash[:notice] = 'Offering was successfully created.'\n format.html { redirect_to(edit_offering_path(@offering, :anchor => \"features\")) }\n format.xml { render :xml => @offering, :status => :created, :location => @offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n ids = Offer.new_offer(offer_params)\n @offer = Offer.get_offer(ids[0], ids[1]) if ids\n #HACK\n @offer = Offer.create(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntitySpecial_offer( entity_id, title, description, terms, start_date, expiry_date, url)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['description'] = description\n params['terms'] = terms\n params['start_date'] = start_date\n params['expiry_date'] = expiry_date\n params['url'] = url\n return doCurl(\"post\",\"/entity/special_offer\",params)\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offers\n authenticated_post(\"offers\").body\n end",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end",
"def create\n @offering = Offering.new(params[:offering])\n\n respond_to do |format|\n if @offering.save\n flash[:notice] = 'Offering was successfully created.'\n format.html { redirect_to(admin_offering_path(@offering)) }\n format.xml { render :xml => @offering, :status => :created, :location => @offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @auto_offer = AutoOffer.new(auto_offer_params)\n\n respond_to do |format|\n if @auto_offer.save\n format.html { redirect_to offers_path, notice: 'Auto offers ware successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render :index, estado: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n @offer.account_id = @oeaccount.id\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_offer\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end",
"def create\n @voucher_offer = VoucherOffer.new(params[:voucher_offer])\n\n respond_to do |format|\n if @voucher_offer.save\n format.html { redirect_to(@voucher_offer, :notice => 'Voucher offer was successfully created.') }\n format.xml { render :xml => @voucher_offer, :status => :created, :location => @voucher_offer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @voucher_offer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n \n respond_to do |format|\n if @offer.save\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ms_offer = MsOffer.new(params[:ms_offer])\n\n respond_to do |format|\n if @ms_offer.save\n format.html { redirect_to @ms_offer, notice: 'Ms offer was successfully created.' }\n format.json { render json: @ms_offer, status: :created, location: @ms_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ms_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_bonus_offer = Shop::BonusOffer.new(params[:shop_bonus_offer])\n\n respond_to do |format|\n if @shop_bonus_offer.save\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully created.' }\n format.json { render json: @shop_bonus_offer, status: :created, location: @shop_bonus_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n flash[:notice] = 'Se ha creado su nueva oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost creata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n if @offer.save\n redirect_to admin_offer_path(@offer), notice: 'Offer was successfully created.'\n else\n render :new\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def create\n @offer = current_user.offers.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def of_generate_offer\n supplier = params[:supplier]\n request = params[:request]\n offer_no = params[:offer_no]\n offer_date = params[:offer_date] # YYYYMMDD\n offer = nil\n offer_item = nil\n code = ''\n\n if request != '0'\n offer_request = OfferRequest.find(request) rescue nil\n offer_request_items = offer_request.offer_request_items rescue nil\n if !offer_request.nil? && !offer_request_items.nil?\n # Format offer_date\n offer_date = (offer_date[0..3] + '-' + offer_date[4..5] + '-' + offer_date[6..7]).to_date\n # Try to save new offer\n offer = Offer.new\n offer.offer_no = offer_no\n offer.offer_date = offer_date\n offer.offer_request_id = offer_request.id\n offer.supplier_id = supplier\n offer.payment_method_id = offer_request.payment_method_id\n offer.created_by = current_user.id if !current_user.nil?\n offer.discount_pct = offer_request.discount_pct\n offer.discount = offer_request.discount\n offer.project_id = offer_request.project_id\n offer.store_id = offer_request.store_id\n offer.work_order_id = offer_request.work_order_id\n offer.charge_account_id = offer_request.charge_account_id\n offer.organization_id = offer_request.organization_id\n if offer.save\n # Try to save new offer items\n offer_request_items.each do |i|\n offer_item = OfferItem.new\n offer_item.offer_id = offer.id\n offer_item.product_id = i.product_id\n offer_item.description = i.description\n offer_item.quantity = i.quantity\n offer_item.price = i.price\n offer_item.tax_type_id = i.tax_type_id\n offer_item.created_by = current_user.id if !current_user.nil?\n offer_item.project_id = i.project_id\n offer_item.store_id = i.store_id\n offer_item.work_order_id = i.work_order_id\n offer_item.charge_account_id = i.charge_account_id\n if !offer_item.save\n # Can't save offer item (exit)\n code = '$write'\n break\n end # !offer_item.save?\n end # do |i|\n # Update totals\n offer.update_column(:totals, Offer.find(offer.id).total)\n else\n # Can't save offer\n code = '$write'\n end # offer.save?\n else\n # Offer request or items not found\n code = '$err'\n end # !offer_request.nil? && !offer_request_items.nil?\n else\n # Offer request 0\n code = '$err'\n end # request != '0'\n if code == ''\n code = I18n.t(\"ag2_purchase.offers.generate_offer_ok\", var: offer.id.to_s)\n end\n @json_data = { \"code\" => code }\n render json: @json_data\n end",
"def create\n @offlearn = Offlearn.new(params[:offlearn])\n\n respond_to do |format|\n if @offlearn.save\n flash[:notice] = 'Offlearn was successfully created.'\n format.html { redirect_to(@offlearn) }\n format.xml { render :xml => @offlearn, :status => :created, :location => @offlearn }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offlearn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @general_offer = GeneralOffer.new(general_offer_params)\n\n respond_to do |format|\n if @general_offer.save\n format.html { redirect_to @general_offer, notice: 'General offer was successfully created.' }\n format.json { render :show, status: :created, location: @general_offer }\n else\n format.html { render :new }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newOffer()\n @offer_operation = :create\n end",
"def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def create\n @shop_resource_offer = Shop::ResourceOffer.new(params[:shop_resource_offer])\n\n respond_to do |format|\n if @shop_resource_offer.save\n format.html { redirect_to @shop_resource_offer, notice: 'Resource offer was successfully created.' }\n format.json { render json: @shop_resource_offer, status: :created, location: @shop_resource_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_resource_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = current_user.offers.build(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Oferta utworzona pomyślnie.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new(params[:sale_offer])\n @sale_offer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @sale_offer.save\n format.html { redirect_to @sale_offer, notice: crud_notice('created', @sale_offer) }\n format.json { render json: @sale_offer, status: :created, location: @sale_offer }\n else\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n format.html { render action: \"new\" }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offerer = Offerer.new(offerer_params)\n #byebug\n\n respond_to do |format|\n if @offerer.save\n format.html { redirect_to @offerer, notice: 'Offerer was successfully created.' }\n format.json { render :show, status: :created, location: @offerer }\n else\n format.html { render :new }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n #byebug\n end",
"def create\n @base_offer = BaseOffer.new(base_offer_params)\n\n respond_to do |format|\n if @base_offer.save\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully created.' }\n format.json { render :show, status: :created, location: @base_offer }\n else\n format.html { render :index }\n format.json { render json: @base_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @help_offer = HelpOffer.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def create\n @special_offer = SpecialOffer.new(special_offer_params)\n\n respond_to do |format|\n if @special_offer.save\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully created.' }\n format.json { render :show, status: :created, location: @special_offer }\n else\n format.html { render :new }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:product, :title, :description)\n end",
"def create\n @shop_special_offer = Shop::SpecialOffer.new(params[:shop_special_offer])\n\n respond_to do |format|\n if @shop_special_offer.save\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully created.' }\n format.json { render json: @shop_special_offer, status: :created, location: @shop_special_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n html = HTMLEntities.new\n params[:administration_offering][:description] = html.encode(params[:administration_offering][:description])\n @administration_offering = Administration::Offering.new(params[:administration_offering])\n\n respond_to do |format|\n if @administration_offering.save\n @administration_offering.add_offering_merchants(params[:administration_merchant_offering])\n format.html { redirect_to(@administration_offering, :notice => 'Offering was successfully created.') }\n format.xml { render :xml => @administration_offering, :status => :created, :location => @administration_offering }\n else\n load_merchants\n @merchant_offerings = Administration::MerchantOffering.find(:all)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @administration_offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_help(id, text)\n url = URI.parse(\"http://#{@@api_url}/helps/add/#{id}.xml#{@config[:apikey]}\")\n req = Net::HTTP::Post.new(url.path+@config[:apikey])\n\n req.basic_auth(@config[:email], @config[:password])\n req.set_form_data({'text' => text})\n\n response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n parse(response.body)\n\n end",
"def new\n @voucher_offer = VoucherOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @voucher_offer }\n end\n end",
"def create(options)\n API::request(:post, 'close_offering_requests', options)\n end",
"def create\n @offer = @company.offers.new(offer_params)\n @offer.user = current_user\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @company, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:estado, :agency, :tipo, :app, :os, :kpi, :geo, :price, :agencyLink, :oferta_des)\n end",
"def create\n @offerte_regel = OfferteRegel.new(offerte_regel_params)\n\n respond_to do |format|\n if @offerte_regel.save\n format.html { redirect_to @offerte_regel, notice: 'Offerte regel was successfully created.' }\n format.json { render :show, status: :created, location: @offerte_regel }\n else\n format.html { render :new }\n format.json { render json: @offerte_regel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_new_entitlement(id, offer) path = \"/api/v2/accounts/#{id}/entitlements/#{offer}\"\n post(path, {}, {}, AvaTax::VERSION) end",
"def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save\n\t\[email protected]_notification\n\t\[email protected]\n\n format.html { redirect_to offers_path(:playerid => current_player.playerid)}\n\t\t#offer_path(@offer, :playerid=> current_player.playerid), notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @volunteer_offering = VolunteerOffering.new(params[:volunteer_offering])\n\n respond_to do |format|\n if @volunteer_offering.save\n flash[:notice] = 'VolunteerOffering was successfully created.'\n format.html { redirect_to(volunteer_tasks_path) }\n format.xml { render :xml => @volunteer_offering, :status => :created, :location => @volunteer_offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @volunteer_offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postEntityAdvertiserUpsell( entity_id, tags, locations, extra_tags, extra_locations, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['extra_tags'] = extra_tags\n params['extra_locations'] = extra_locations\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/upsell\",params)\n end",
"def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n c= Compare.find(params[:compare])\n c.offers<< Offer.new(offer_params)\n # @offer = Offer.new(offer_params)\n @offer = c.offers.last\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to [@offer.compare.site,@offer], notice: 'offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @peep = Peep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def create\n @offer_article = OfferArticle.new(offer_article_params)\n\n respond_to do |format|\n if @offer_article.save\n format.html { redirect_to :back, notice: 'Offer article was successfully created.' }\n format.json { render :show, status: :created, location: @offer_article }\n else\n format.html { render :new }\n format.json { render json: @offer_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @charity_offer = CharityOffer.new(charity_offer_params)\n\n respond_to do |format|\n if @charity_offer.save\n format.html { redirect_to @charity_offer, notice: 'Charity offer was successfully created.' }\n format.json { render :show, status: :created, location: @charity_offer }\n else\n format.html { render :new }\n format.json { render json: @charity_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:offer_id, :user_id, :company_id, :position, :employment_type, :responsiveness, :experience, :response_time, :address, :latitude, :longitude, :street_number, :locality, :route, :offer, :administrative_area_level_1, :country, :postal_code)\n end",
"def offer_params\n params.require(:offer).permit(:advertiser_name, :url, :description, :starts_at, :ends_at, :premium, :offer_state)\n end",
"def create\n @offer = Offer.new(offer_params)\n @offer.user = current_user\n authorize @offer\n\n respond_to do |format|\n if @offer.save\n Offer.delay.reindex\n\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:name, :description, :reward_description, :reward_factor, :redemption_value, :active, :image_url, :published, :expires)\n end",
"def create\n @ep = Ep.new(params[:ep])\n\n respond_to do |format|\n if @ep.save\n flash[:notice] = 'Ep was successfully created.'\n format.html { redirect_to(@ep) }\n format.xml { render :xml => @ep, :status => :created, :location => @ep }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ep.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @offlearn = Offlearn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offlearn }\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n flash[:notice] = 'Se ha creado una oferta'\n format.html { redirect_to @offer}\n format.json { render :show, status: :created, location: @offer }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:merchant_id, :title, :description, :url, :expires_at)\n end",
"def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end",
"def create\n @locations = Location.where(\"status <> 'NORMAL'\").order(\"state, township desc\")\n @aid_offer = AidOffer.new(aid_offer_params)\n @aid_offer.code = SecureRandom.hex(3).to_s.upcase.insert(3,\"-\").insert(0,\"O-\")\n\n respond_to do |format|\n if @aid_offer.save\n format.html { redirect_to @aid_offer, notice: 'Aid offer was successfully created.' }\n format.json { render :show, status: :created, location: @aid_offer }\n else\n format.html { render :new }\n format.json { render json: @aid_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peep = Peep.new(params[:peep])\n\n respond_to do |format|\n if @peep.save\n format.html { redirect_to(@peep, :notice => 'Peep was successfully created.') }\n format.xml { render :xml => @peep, :status => :created, :location => @peep }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @peep.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def manage_offer_for\n @offer_for = params[:for]\n @offer = @host.offers.find(params[:id])\n if request.post?\n if params[:places].present?\n @offer.places = []\n @offer.places << Place.find(params[:places])\n elsif params[:experiences].present?\n @offer.experiences = []\n @offer.experiences << Experience.find(params[:experiences])\n end\n end\n end",
"def create\n @offpost = Offpost.new(params[:offpost])\n\n respond_to do |format|\n if @offpost.save\n flash[:notice] = 'Offpost was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @offpost, :status => :created, :location => @offpost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offpost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end",
"def service_offered\n [\n IMS::LTI::Models::RestService.new(\n id: \"#{base_url}/lti/v2/services#vnd.Canvas.SubmissionEvent\",\n action: %w(POST),\n endpoint: \"#{base_url}/event/submission\"\n )\n ]\n end",
"def create\n @offering = current_user.offerings.new(offering_params)\n @offering.status = 1\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @offering }\n else\n format.html { render :new }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def response_for_offer_create(params)\n {\"response\" => { \"status\" => 1, \"data\" => rand(1_000_000).to_s } }\n end",
"def create_help_request\n @help_request = HelpRequest.new(params[:help])\n end",
"def offer_params\n params.require(:offer).permit(:product, :origins, :destination, :volumen, :price, :container, :general_load, :liquid_load, :load_compensation, :offert_type, :unit, :observation, :status, :service_start_date, :offer_finish_date, :offer_start_date, :service_finish_date)\n end",
"def create\n @breadcrumb = 'create'\n @offer = Offer.new(params[:offer])\n @offer.created_by = current_user.id if !current_user.nil?\n # Should use attachment from drag&drop?\n if @offer.attachment.blank? && !$attachment.avatar.blank?\n @offer.attachment = $attachment.avatar\n end\n\n respond_to do |format|\n $attachment_changed = false\n if @offer.save\n $attachment.destroy\n $attachment = nil\n format.html { redirect_to @offer, notice: crud_notice('created', @offer) }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n $attachment.destroy\n $attachment = Attachment.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @payment_methods = payment_methods_dropdown\n # @products = products_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end",
"def create\n @credits_offer = CreditsOffer.new(credits_offer_params)\n respond_to do |format|\n if @credits_offer.save\n format.html { redirect_to @credits_offer, notice: 'CreditsOffer was successfully created.' }\n format.json { render :show, status: :created, location: @credits_offer }\n else\n format.html { render :new }\n format.json { render json: @credits_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_offer\n @paramss = params[:id].split(',')\n @offer = Offer.get_offer(@paramss[0], @paramss[1])\n end",
"def new\n @volunteer_offering = VolunteerOffering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer_offering }\n end\n end",
"def new\n @poll_option = PollOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll_option }\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def offer_params\n params.require(:offer).permit(:proposal,:price, :post_id, :status)\n end",
"def create\n @poll = Poll.new(params[:poll])\n @poll.poll_options ||= PollOptions.new\n @poll.poll_options.enable_captcha = params[:enable_captcha]\n\n @poll.candidates = posted_candidates\n\n\n @poll.initialize_keys\n\n respond_to do |format|\n if @poll.save\n flash[:notice] = 'Poll was successfully created.'\n format.html { redirect_to :action => :admin, :key => @poll.admin_key }\n format.xml { render :xml => @poll, :status => :created, :location => @poll }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @poll.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @poll = Poll.new(params[:poll])\n\n respond_to do |format|\n if @poll.save\n format.html { redirect_to([:admin, @poll], :notice => 'Poll was successfully created.') }\n format.xml { render :xml => @poll, :status => :created, :location => @poll }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @poll.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @offering = Offering.new(params[:offering])\n @offering.event_id = params[:event_id]\n @offering.user_id = current_user.id\n\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'Oferta criada com sucesso.' }\n format.json { render json: @offering, status: :created, location: @offering }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_description\n params['offer']\n end",
"def new\n @poll = Poll.new\n @poll.poll_options = PollOptions.new\n @title = \"Create a new poll\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end",
"def offer_description\n params['offer']\n end"
] | [
"0.68153745",
"0.65514785",
"0.63898456",
"0.6315262",
"0.6294513",
"0.61922425",
"0.6176346",
"0.6169426",
"0.6169426",
"0.6144895",
"0.61372346",
"0.6112166",
"0.6110679",
"0.610906",
"0.610274",
"0.60936046",
"0.6074937",
"0.6074925",
"0.5988498",
"0.5977947",
"0.5951662",
"0.593768",
"0.5916424",
"0.58751565",
"0.58728456",
"0.5870224",
"0.5869449",
"0.5840755",
"0.58168674",
"0.5791572",
"0.5778834",
"0.5770062",
"0.57612395",
"0.57400554",
"0.5710528",
"0.5705479",
"0.5696746",
"0.56840277",
"0.5681245",
"0.56428057",
"0.56222665",
"0.5587133",
"0.55834395",
"0.5578452",
"0.5576962",
"0.5571198",
"0.5566921",
"0.55584615",
"0.5553134",
"0.55484754",
"0.55426455",
"0.5536678",
"0.5519106",
"0.5516523",
"0.5506979",
"0.5502481",
"0.5485644",
"0.5485098",
"0.547742",
"0.5467938",
"0.5467372",
"0.5458359",
"0.5453267",
"0.54493314",
"0.5444008",
"0.54109913",
"0.5410738",
"0.54105693",
"0.5409712",
"0.53916645",
"0.53916645",
"0.53916645",
"0.53743505",
"0.537025",
"0.53674954",
"0.53592026",
"0.5354933",
"0.5352266",
"0.53238285",
"0.5323166",
"0.53104883",
"0.5304089",
"0.52973706",
"0.5296194",
"0.52948713",
"0.5288131",
"0.52851593",
"0.52808636",
"0.5276554",
"0.52680385",
"0.52631164",
"0.52567416",
"0.52531964",
"0.52417797",
"0.5240844",
"0.523111",
"0.52289766",
"0.52285016",
"0.52199477",
"0.52187574"
] | 0.656126 | 1 |
PUT /help_offers/1 PUT /help_offers/1.xml | def update
@help_offer = HelpOffer.find(params[:id])
if @help_offer.user != current_user && @help_offer.job_request.user != current_user
raise "You dont have permission to edit this help offer"
end
respond_to do |format|
if @job_request.user == current_user
#accepting offer
@help_offer.accepted = true
if @help_offer.update_attributes(params[:help_offer]) && @job_request.offered!
#TODO send email to help offerer
flash[:notice] = "Offer accepted, confirmation from #{@help_offer.user.name} required."
format.html { redirect_to(job_request_url(@job_request)) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @help_offer.errors, :status => :unprocessable_entity }
end
else
if @help_offer.update_attributes(params[:help_offer])
flash[:notice] = 'HelpOffer was successfully updated.'
format.html { redirect_to(job_request_url(@job_request)) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @help_offer.errors, :status => :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end",
"def updateOffer()\n @offer_operation = :update\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n\n if @offer.update(offer_params)\n head :no_content\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end",
"def update\n ids = Offer.update_offer(offer_params, @paramss[0], @paramss[1])\n @offer.update(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_resource_offer.update_attributes(params[:shop_resource_offer])\n format.html { redirect_to @shop_resource_offer, notice: 'Resource offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_resource_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @auto_offer.update(auto_offer_params)\n format.html { redirect_to @auto_offer, notice: 'Auto offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n \n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n if @ms_offer.update_attributes(params[:ms_offer])\n format.html { redirect_to @ms_offer, notice: 'Ms offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ms_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_bonus_offer.update_attributes(params[:shop_bonus_offer])\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voucher_offer = VoucherOffer.find(params[:id])\n\n respond_to do |format|\n if @voucher_offer.update_attributes(params[:voucher_offer])\n format.html { redirect_to(@voucher_offer, :notice => 'Voucher offer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voucher_offer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @offer\n\n respond_to do |format|\n if @offer.update(offer_params)\n Offer.delay.reindex\n\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(admin_offering_path(@offering)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :index, estado: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Oferta zmieniona pomyślnie.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n @shop_special_offer = Shop::SpecialOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_special_offer.update_attributes(params[:shop_special_offer])\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n format.html { redirect_to @offering, notice: 'Oferta atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = @offer_article.offer\n respond_to do |format|\n if @offer_article.update(offer_article_params)\n format.html { redirect_to @offer, notice: 'Offer article was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer_article }\n else\n format.html { render :edit }\n format.json { render json: @offer_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n if @accepted_offer.update_attributes(params[:accepted_offer])\n format.html { redirect_to @accepted_offer, notice: 'Accepted offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @accepted_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @offer.update(offer_params)\n redirect_to @offer, notice: 'Offer was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n flash[:notice] = 'Se ha modificado su oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to [@offer.compare.site,@offer], notice: 'offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n offer = params[:offer]\n unless offer.nil?\n @offer.prizes_attributes = offer[:prizes_attributes] unless offer[:prizes_attributes].nil?\n @offer.name = offer[:name]\n @offer.start_date = offer[:start_date]\n @offer.end_date = offer[:end_date]\n @offer.created_at = Time.now\n @offer.updated_at = Time.now\n @offer.photo = offer[:photo]\n @offer.branch = Branch.find(offer[:branch_id])\n @offer.description = offer[:description]\n @offer.start_date = @offer.start_date.change({:hour => (offer[:start_hour]).to_i})\n @offer.end_date = @offer.end_date.change({:hour => (offer[:end_hour]).to_i})\n respond_to do |format|\n if @offer.save\n title_ids = params[:title_ids]\n unless title_ids.nil?\n ot = OffersTitles.find_all_by_offer_id(@offer.id)\n ot.each do |o|\n o.destroy\n end\n title_ids.each do |id|\n# unless @offer.prefer(Title.find(id))\n offers_titles = OffersTitles.new\n offers_titles.offer_id = @offer.id\n offers_titles.title_id = id\n offers_titles.save\n # end\n end\n end\n format.html { redirect_to @offer, notice: 'La oferta fue actualizada correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end\n if @offer.nil?\n format.html { redirect_to @offer }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: '¡El Voucher se ha canjeado con éxito!' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @offer = Offer.find(params[:id])\n end",
"def update\n @offlearn = Offlearn.find(params[:id])\n\n respond_to do |format|\n if @offlearn.update_attributes(params[:offlearn])\n flash[:notice] = 'Offlearn was successfully updated.'\n format.html { redirect_to(@offlearn) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offlearn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer.user, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offering ||= Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(@offering) }\n format.xml { head :ok }\n format.js { render :text => \"Saved at #{Time.now.to_s(:time12)}.\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n format.js { render :text => \"Could not save offering.\", :status => 409 }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offering.update(offering_params)\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @offering }\n else\n format.html { render :edit }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @base_offer.update(base_offer_params)\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @base_offer }\n else\n @base_offers = BaseOffer.all.map{ |c| c = (c.id == @base_offer.id)? @base_offer:c}\n @base_offer = BaseOffer.new\n format.html { render :index }\n format.json { render json: @base_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text_book_sale_offer.update(text_book_sale_offer_params)\n format.html { redirect_to @text_book_sale_offer, notice: 'Text book sale offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @text_book_sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_offer\n if params[:id] == 'new'\n render status: 404\n return\n end\n offer = Offer.find(params[:id])\n @offer = offer\n end",
"def update\n respond_to do |format|\n if @serv_offer.update(serv_offer_params)\n format.html { redirect_to @serv_offer, notice: 'Serv offer was successfully updated.' }\n format.json { \n render json: {status:0, msg:\"success\"}\n }\n else\n format.html { render :edit }\n format.json {\n render json: { status: -1 }\n }\n end\n end\n end",
"def set_offer\n @offer = Offer.find(params[:id].to_i)\n end",
"def edit\n @offer = InternshipOffer.find(params[:id])\n end",
"def update!(**args)\n @available_offers = args[:available_offers] if args.key?(:available_offers)\n @no_offer_reason = args[:no_offer_reason] if args.key?(:no_offer_reason)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def update\n @offer = Offer.find(params[:id])\n if user_owns_offer?(@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n else\n format.html {redirect_to :status => 422}\n end \n end",
"def update\n @office.update(office_params)\n head :no_content\n end",
"def show\n @help_offer = HelpOffer.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def set_offer\n @offer = Offer.find_by_id(params[:id])\n end",
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end",
"def set_offer\n @paramss = params[:id].split(',')\n @offer = Offer.get_offer(@paramss[0], @paramss[1])\n end",
"def manage_offer\n @offer = @host.offers.find(params[:id])\n end",
"def update\n @volunteer_offering = VolunteerOffering.find(params[:id])\n\n respond_to do |format|\n if @volunteer_offering.update_attributes(params[:volunteer_offering])\n flash[:notice] = 'VolunteerOffering was successfully updated.'\n format.html { redirect_to(@volunteer_offering) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @volunteer_offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n respond_to do |format|\n if @special_offer.update(special_offer_params)\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_offer }\n else\n format.html { render :edit }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @general_offer.update(general_offer_params)\n format.html { redirect_to @general_offer, notice: 'General offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @general_offer }\n else\n format.html { render :edit }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n respond_to do |format|\n if @market_offering.update(market_offering_params)\n format.html { redirect_to @market_offering, notice: 'Market offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @market_offering }\n else\n format.html { render :edit }\n format.json { render json: @market_offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n if @job_offer.update_attributes(params[:job_offer])\n format.html { redirect_to job_offers_path(@job_offer), notice: 'Job offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_platinum_offer.update_attributes(params[:shop_platinum_offer])\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quick_poll_option = QuickPollOption.find(params[:id])\n\n respond_to do |format|\n if @quick_poll_option.update_attributes(params[:quick_poll_option])\n format.html { redirect_to @quick_poll_option, notice: 'Quick poll option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quick_poll_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n if @peep.update_attributes(params[:peep])\n format.html { redirect_to(@peep, :notice => 'Peep was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @peep.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @poll_option = PollOption.find(params[:id])\n\n respond_to do |format|\n if @poll_option.update_attributes(params[:poll_option])\n format.html { redirect_to(@poll_option, :notice => 'PollOption was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @poll_option.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def new\n @help_offer = @job_request.help_offers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @help_offer }\n end\n end",
"def set_serv_offer\n @serv_offer = Good.find(params[:id])\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end",
"def update\n @public_offer = PublicOffer.find(params[:id])\n\n respond_to do |format|\n if @public_offer.update_attributes(params[:public_offer])\n format.html { redirect_to club_public_offers_path(@club), notice: 'Das Angebot wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68809974",
"0.6786649",
"0.65002185",
"0.648612",
"0.648612",
"0.6473508",
"0.6473457",
"0.6356743",
"0.6352532",
"0.6352387",
"0.6294533",
"0.6275752",
"0.6251643",
"0.6241829",
"0.6241829",
"0.6239832",
"0.6201567",
"0.61994845",
"0.6183136",
"0.6164906",
"0.61623156",
"0.6161964",
"0.61491215",
"0.60414636",
"0.6028235",
"0.6024029",
"0.5984824",
"0.5976084",
"0.5937437",
"0.5906258",
"0.58730745",
"0.5864214",
"0.5858199",
"0.58570683",
"0.5852934",
"0.5846605",
"0.58163553",
"0.5809197",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.5808088",
"0.58060366",
"0.5800008",
"0.5782682",
"0.57725316",
"0.57725316",
"0.57725316",
"0.5761775",
"0.57571083",
"0.5754513",
"0.57521933",
"0.57441145",
"0.5740019",
"0.57289153",
"0.57260275",
"0.5722317",
"0.5714193",
"0.57096636",
"0.570108",
"0.56974643",
"0.5694357",
"0.5686573",
"0.5675502",
"0.5674602",
"0.5671135",
"0.56704247",
"0.5668282",
"0.5665945",
"0.56547433",
"0.565023",
"0.56487525",
"0.5647568",
"0.56307966",
"0.5629465",
"0.5622271",
"0.56164217",
"0.56094426",
"0.5607382",
"0.55924284",
"0.5580468",
"0.5578952",
"0.5574414",
"0.5570905",
"0.5556155"
] | 0.5834701 | 36 |
DELETE /help_offers/1 DELETE /help_offers/1.xml | def destroy
@help_offer = HelpOffer.find(params[:id])
if @help_offer.user != current_user
raise 'Only users that create help offers can destroy them'
end
if @job_request.accepted_offer == @help_offer
@job_request.status = 'open'
@job_request.save!
end
@help_offer.destroy
flash[:notice] = "Your help offer has been removed."
respond_to do |format|
format.html { redirect_to(job_request_url(@job_request)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @voucher_offer = VoucherOffer.find(params[:id])\n @voucher_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to(voucher_offers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @local_offer = LocalOffer.find(params[:id])\n @local_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to(local_offers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n\n head :no_content\n end",
"def destroy\n @offering = Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_offerings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @offlearn = Offlearn.find(params[:id])\n @offlearn.destroy\n\n respond_to do |format|\n format.html { redirect_to(offlearns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offering ||= Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(offerings_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @poll = Poll.find_by_admin_key(params[:key])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to(polls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auto_offer.destroy\n respond_to do |format|\n format.html { redirect_to auto_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @administration_offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(administration_offerings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rhelp = Rhelp.find(params[:id])\n @rhelp.destroy\n\n respond_to do |format|\n format.html { redirect_to(rhelps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @helpdb = Helpdb.find(params[:id])\n @helpdb.destroy\n\n respond_to do |format|\n format.html { redirect_to(helpdbs_url) }\n format.xml { head :ok }\n end\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def destroy\n @peep = Peep.find(params[:id])\n @peep.destroy\n\n respond_to do |format|\n format.html { redirect_to(peeps_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @bill = Bill.find(params[:id])\n offer = @bill.offer\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(offer) }\n format.xml { head :ok }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n \n respond_to do |format|\n format.html { redirect_to admins_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ms_offer = MsOffer.find(params[:id])\n @ms_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to ms_offers_url }\n format.json { head :no_content }\n end\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @office = Office.find(params[:id])\n @office.destroy\n\n respond_to do |format|\n format.html { redirect_to(offices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @poll = Poll.find(params[:id])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wpolls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to(exps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @essay = Essay.find(params[:id])\n # Lo que pasa es que el metodo delete me pasa una id en los params de a afuerzas\n # en este caso se usa params[:id] en vez de params[:url_title] como lo hice en el show\n @essay = Essay.find_by_url_title(params[:id]) if !params[:id].nil?\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to(essays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n @shop_resource_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_resource_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_offers_url,\n notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_offer(slug)\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n delete(\"/offer/#{slug}\")\n end",
"def destroy\n @ep = Ep.find(params[:id])\n @ep.destroy\n\n respond_to do |format|\n format.html { redirect_to(eps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n Offer.destroy_offer(@paramss[0], @paramss[1])\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poll_option = PollOption.find(params[:id])\n @poll_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(poll_options_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @apparel = Apparel.find(params[:id])\n @apparel.destroy\n\n respond_to do |format|\n format.html { redirect_to(apparels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @helocapp = Helocapp.find(params[:id])\n @helocapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocapps_url) }\n format.xml { head :ok }\n end\n end",
"def deleteEntitySpecial_offer( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/special_offer\",params)\n end",
"def destroy\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n @shop_bonus_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_bonus_offers_url }\n format.json { head :ok }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @elemento = Elemento.find(params[:id])\n @elemento.destroy\n\n respond_to do |format|\n format.html { redirect_to(elementos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @advertise = Advertise.find(params[:id])\n @advertise.destroy\n\n respond_to do |format|\n format.html { redirect_to(advertises_url) }\n format.xml { head :ok }\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @hostel = Hostel.find(params[:id])\n @hostel.destroy\n\n respond_to do |format|\n format.html { redirect_to(hostels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @base_offer.destroy\n respond_to do |format|\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_path, notice: 'Oferta a fost stearsa cu success.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qx = Qx.find(params[:id])\n @qx.destroy\n\n respond_to do |format|\n format.html { redirect_to(qxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n @goods_auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_auto_options_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @echo = Echo.find(params[:id])\n @echo.destroy\n\n respond_to do |format|\n format.html { redirect_to(echoes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entity_end_point_rel = EntityEndPointRel.find(params[:id])\n @entity_end_point_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(entity_end_point_rels_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy_rest\n @entry_answer = EntryAnswer.find(params[:id])\n @entry_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @aid_offer.destroy\n respond_to do |format|\n format.html { redirect_to aid_offers_url, notice: 'Aid offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to site_offers_url, notice: 'offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n flash[:notice] = 'Se ha eliminado exitosamente'\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy; delete end",
"def delete\n \n end",
"def destroy\n @available_off = AvailableOff.find(params[:id])\n @available_off.destroy\n\n respond_to do |format|\n format.html { redirect_to(employee_available_offs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Oferta eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_book_sale_offer.destroy\n respond_to do |format|\n format.html { redirect_to text_book_sale_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale_offer = SaleOffer.find(params[:id])\n\n respond_to do |format|\n if @sale_offer.destroy\n format.html { redirect_to sale_offers_url,\n notice: (crud_notice('destroyed', @sale_offer) + \"#{undo_link(@sale_offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to sale_offers_url, alert: \"#{@sale_offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @hotel = Hotel.find(params[:id])\n @hotel.destroy\n\n respond_to do |format|\n format.html { redirect_to(hotels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hotel = Hotel.find(params[:id])\n @hotel.destroy\n\n respond_to do |format|\n format.html { redirect_to(hotels_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def destroy\n @helibasis = Helibase.find(params[:id])\n @helibasis.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end",
"def delete_special_offer(special_offer)\n delete \"special_offers/#{special_offer}\"\n end",
"def destroy\n @exammaker = Exammaker.find(params[:id])\n @exammaker.destroy\n\n respond_to do |format|\n format.html { redirect_to(exammakers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @exammaker = Exammaker.find(params[:id])\n @exammaker.destroy\n\n respond_to do |format|\n format.html { redirect_to(exammakers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def delete\n eadid = (params[\"eadid\"] || \"\").strip\n if eadid == \"\"\n log_error(\"Cannot delete EAD. No ID was provided.\")\n flash[:alert] = \"No EAD ID was provided.\"\n redirect_to upload_list_url()\n return\n end\n\n filename = ENV[\"EAD_XML_PENDING_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n if !File.exist?(filename)\n log_error(\"Cannot delete EAD. File was not found: #{filename}\")\n flash[:alert] = \"Source file not found for finding aid: #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n target = ENV[\"EAD_XML_DELETED_FILES_PATH\"] + \"/\" + eadid + \".xml\"\n FileUtils.mv(filename, target)\n\n if !File.exist?(target)\n log_error(\"File delete failed: #{filename}\")\n flash[:alert] = \"Could not delete finding aid #{eadid}.\"\n redirect_to upload_list_url()\n return\n end\n\n Rails.logger.info(\"Findind aid #{eadid} has been deleted\")\n flash[:notice] = \"Findind aid #{eadid} has been deleted\"\n redirect_to upload_list_url()\n rescue => ex\n render_error(\"delete\", ex, current_user)\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n redirect_to offers_url, notice: 'Offer was successfully destroyed.'\n end\n end",
"def DeleteArticle id\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'DELETE')\n \n end",
"def deleteEntityAdvertiser( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/advertiser\",params)\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Su oferta ha sido eliminada.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.6665935",
"0.6614053",
"0.6556441",
"0.6553204",
"0.65302527",
"0.6504326",
"0.64642495",
"0.6421738",
"0.640071",
"0.63902247",
"0.6387391",
"0.6357924",
"0.634052",
"0.6331929",
"0.63229895",
"0.6311654",
"0.63091135",
"0.63044333",
"0.62851113",
"0.6276473",
"0.62751585",
"0.62746644",
"0.6272729",
"0.6269402",
"0.6264265",
"0.62630093",
"0.6252988",
"0.62290454",
"0.6211695",
"0.6210943",
"0.6207276",
"0.62059665",
"0.6204269",
"0.62029284",
"0.6191741",
"0.6191741",
"0.6191179",
"0.61837304",
"0.6176263",
"0.61714435",
"0.61688316",
"0.6157393",
"0.6155587",
"0.6143487",
"0.61414194",
"0.61374927",
"0.6129549",
"0.6129549",
"0.61285204",
"0.6124626",
"0.611892",
"0.61173964",
"0.6113941",
"0.6102546",
"0.6102546",
"0.61003274",
"0.60964257",
"0.6094702",
"0.6084769",
"0.6076281",
"0.60719824",
"0.60695183",
"0.60695183",
"0.6062539",
"0.60586476",
"0.60571045",
"0.60571045",
"0.6053772",
"0.6053543",
"0.60454434",
"0.60419655",
"0.6040722",
"0.6040295",
"0.6035055",
"0.6034067",
"0.6034067",
"0.60324687",
"0.6029426",
"0.6029426",
"0.6029426",
"0.6029426",
"0.6026644",
"0.6026248",
"0.6023119",
"0.6023119",
"0.6020695",
"0.6020192",
"0.60188437",
"0.6017736",
"0.60135454",
"0.60097265",
"0.6009254",
"0.6005144",
"0.6005144",
"0.6005144",
"0.6005144",
"0.6005144",
"0.6005144",
"0.6005144",
"0.60033023"
] | 0.62715256 | 23 |
Returns the result of the get operation | def get(url)
private_get(url)
Fiber.yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n execute(:get)\n end",
"def get\n execute(:get)\n end",
"def get\n execute(:get).to_s\n end",
"def get(key)\n\n # FIXME: insert code that connects to the backend and affects the get\n # operation\n #\n # - If possible, this get should be done atomically\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end",
"def get(*args)\n execute(:get, *args)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get!\n clear and get\n end",
"def get\n end",
"def get_data\n\t\texecute unless @result\n\t\treturn get_data_from_result(@result)\n\tend",
"def get()\n \n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get_result(key)\n r = results\n if r != nil\n return r.fetch(key, nil)\n end\n nil\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def get; end",
"def get\n url = prefix + \"get\" + id_param\n return response(url)\n end",
"def get(*args, &block)\n connection.get(*args, &block)\n end",
"def fetch\n @value\n end",
"def get(*args)\n val = args.empty? ? self : retrieve(*args)\n val == NO_VALUE ? nil : val\n end",
"def fetch\n @fetched_value\n end",
"def get()\n return @http.request(@req)\n end",
"def get\n raise StandardError, \"Implement '.get' in your Cache!\"\n end",
"def fetch(key)\n result.fetch(key)\n end",
"def get_result\n\t\texecute unless @result\n\t\treturn @result\n\tend",
"def get\n start { |connection| connection.request http :Get }\n end",
"def get\n val = @source.get\n return nil if val.nil?\n processed_val = process(val)\n if processed_val.nil?\n get\n else\n return processed_val\n end\n\n end",
"def get\n @mutex.synchronize { @value }\n end",
"def get(options = {})\n end",
"def show\n result = get\n end",
"def _get\n http_method(:get)\n end",
"def get\n check_response( @httpcli.get(@endpoint) )\n end",
"def result\n @result\n end",
"def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend",
"def get_value\n send_request(FUNCTION_GET_VALUE, [], '', 2, 'S')\n end",
"def get(data = {})\n call data, method: :get\n end",
"def get\n end",
"def get(key)\n return do_get(key, false)\n end",
"def get(key)\n @manager.retrieve(key)\n end",
"def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end",
"def get_resource\n execute(resource_path, method: :get)\n end",
"def result\n results.first\n end",
"def result\n meta.fetch(:result, :one)\n end",
"def get_operation_result\n @connection.get_operation_result\n end",
"def _get_with_connection(connection, store_name, key, should_route)\r\n\t\t\"\"\"Execute get request to the given store. Returns a (value, version) pair.\"\"\"\r\n\r\n\t\treq = VoldemortRequest.new\r\n\t\treq.should_route = should_route\r\n\t\treq.store = store_name\r\n\t\treq.type = RequestType::GET\r\n req.get = GetRequest.new\r\n\t\treq.get.key = key\r\n\r\n\t\t# send request\r\n\t\t_send_request(connection, req.serialize_to_string())\r\n\r\n\t\t# read and parse response\r\n\t\tresp_str = _receive_response(connection)\r\n\t\tresp = GetResponse.new\r\n\t\tresp = resp.parse_from_string(resp_str)\r\n\t\t_check_error(resp)\r\n\r\n\t\treturn _extract_versions(resp.versioned)\r\n end",
"def get(key, req_options = nil)\n perform(:get, key, req_options)\n end",
"def get\n object\n end",
"def result \n @result\n end",
"def result\n results[0]\n end",
"def get(*args, &block)\n end",
"def retrieve\n self.class.get( id )\n end",
"def get *args, &block\n handle @conn.get *args, &block\n end",
"def fetch\n\n caching_enabled = is_caching_enabled()\n if caching_enabled\n result = fetch_from_cache\n end\n\n if !caching_enabled || (caching_enabled && result == nil)\n db_return = query()\n\n result = make_result_object(db_return.columns.as_json, db_return.as_json)\n if caching_enabled\n store_in_cache result\n end\n end\n result\n end",
"def get\n request_object.get_query\n end",
"def get(id)\n @service.get(id)\n end",
"def get\n raise NotImplementedError\n end",
"def get(command, options)\n @client.get(command, options)\n end",
"def retrieve\n end",
"def get(key)\n result = connection.query(\"TREG\", \"GET\", key)\n\n Result.parse(result)\n end",
"def result\n\t\t@result\n\tend",
"def get(params)\n request.method = :get\n execute(params)\n end",
"def get(params = {})\n params = params.with_indifferent_access\n\n get_from_memory(params) || force_fetch(params)\n end",
"def get\n\t\t\t@hash\n\t\tend",
"def get(id, db = database)\n begin\n get!(id, db)\n rescue\n nil\n end\n end",
"def _get(key)\r\n\t\treturn _get_with_connection(@connection, @store_name, key, true)\r\n end",
"def get(*args, &block); end",
"def get\n @cached_value ||= RedisModel::Base.connection.get(key_label)\n end",
"def getResult\n return @out\n end",
"def get_result\n @product\n end",
"def get(key)\n run_hook(:before_get, key)\n value = db[key]\n run_hook(:after_get, key, value)\n value\n end",
"def get(options = nil)\n options ||= {}\n options[:method] = :get\n call options\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def result\n @@result\n end",
"def get(path, params = {})\n execute :get, path, params\n end",
"def get(key)\n mon_synchronize do\n perform [\"get\", key]\n end\n end",
"def get(key)\n mon_synchronize do\n perform [\"get\", key]\n end\n end",
"def get(path, query = {})\n make_call(mk_conn(path), :get, nil, query)\n end",
"def result\n @data['result']\n end",
"def get(resource, other_query = nil)\n raise NotImplementedError, \"#{self.class}#get not implemented\"\n end",
"def get(x = None, y = None)\n execute(:get, x, y)\n end",
"def perform_get(path, options = {})\n perform_request(:get, path, options)\n end",
"def get(key)\n db.get(key)\n end",
"def get(path, params = {})\n @connection.get(path, params)\n end",
"def get(key)\n get_all(key).first\n end",
"def value\n v = connection.get(key)\n rescue Memcached::NotFound\n if block\n value = block.call\n value\n end\n end",
"def rest_get\n ##define the url path\n url =\"/get\"\n\n ##This is headers definition.\n headers = [\n ['Cached-Control', \"no-cache\" ],\n [\"Content-Type\", \"application/x-www-form-urlencoded\"]\n ]\n begin\n #------------------------\n # Send Get Request\n #------------------------\n request, response = send_get(url, headers)\n\n if response.code.to_i == 200\n actual_value = response.body.chop!\n actual_value.gsub!(\"\\n\",\"\")\n return actual_value.gsub!(/\\s+/, \"\")\n else\n return false\n end\n rescue Exception => ex\n @log.error \"#### Response code is: #{response.code} #####\"\n @log.error ex.message\n puts \"#### Response code is: #{response.code} #####\"\n puts ex.message\n return false\n end\n end",
"def get(path, options = {})\n connection.get(path, options)\n end",
"def get \n return 1\n end",
"def cache_get(ck)\n cache_op(:get, ck)\n end",
"def get\n end",
"def get(id, options = GetOptions.new)\n resp = if options.need_projected_get?\n @backend.document_get_projected(bucket_name, \"#{@scope_name}.#{@name}\", id,\n options.timeout,\n options.with_expiry,\n options.projections,\n options.preserve_array_indexes)\n else\n @backend.document_get(bucket_name, \"#{@scope_name}.#{@name}\", id, options.timeout)\n end\n GetResult.new do |res|\n res.transcoder = options.transcoder\n res.cas = resp[:cas]\n res.flags = resp[:flags]\n res.encoded = resp[:content]\n res.expiry = resp[:expiry] if resp.key?(:expiry)\n end\n end",
"def get(aName,aKey)\n i = searchKey(aName,aKey)\n result = serv_data[i].values[0]\n if i != '' then\n updateLastGet(i)\n return \"VALUE #{result.values[0][0]} #{result.keys[0]} #{result.values[0][1]} #{result.values[0][2]} #{result.values[0][3]}\"\n else\n return \"VALUE\"\n end\n end",
"def get\n val\n end",
"def get\n val\n end",
"def get\n if(resource.exist?)\n #print_range(request)\n res = resource.get(request, response)\n if(res == OK && !resource.collection?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Content-Length'] = resource.content_length.to_s\n response['Last-Modified'] = resource.last_modified.httpdate\n end\n res\n else\n NotFound\n end\n end",
"def result\n data(\"result\")\n end",
"def get(which = :converted, &block)\n unless error?\n RestClient.get(send(which), &block)\n end\n end",
"def orchio_get\n if cache.enabled? and response = cache_request.get(id)\n if response.header.status == :cache\n doc = response.body.document\n end\n else\n response = client.send_request :get, inst_args if response.nil?\n doc = Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n ))\n end\n Result.new(\n status: orchio_status(response, 200),\n response: response,\n results: [ doc ]\n )\n end",
"def get\n @value\n end",
"def get(request_opts = {})\n store_result(http(request_opts).get(resolved_path))\n end"
] | [
"0.78878057",
"0.78878057",
"0.7808642",
"0.7428613",
"0.69331926",
"0.69275045",
"0.69275045",
"0.6909106",
"0.6895932",
"0.68577737",
"0.6807275",
"0.67328674",
"0.67328674",
"0.67231333",
"0.67056185",
"0.6705038",
"0.6701849",
"0.66738975",
"0.66729003",
"0.6663837",
"0.66467226",
"0.6634572",
"0.66231036",
"0.66208947",
"0.660618",
"0.6586285",
"0.6579251",
"0.6577662",
"0.6555304",
"0.65533876",
"0.65517867",
"0.654671",
"0.64943284",
"0.64725065",
"0.6465498",
"0.6458293",
"0.6440961",
"0.6440843",
"0.6436934",
"0.64074314",
"0.6390679",
"0.6389401",
"0.63867164",
"0.6386104",
"0.63799405",
"0.63731575",
"0.63691694",
"0.6353203",
"0.634611",
"0.63450605",
"0.6342973",
"0.6328237",
"0.6319546",
"0.63114476",
"0.6298859",
"0.6296203",
"0.62944275",
"0.6292905",
"0.6292421",
"0.62909627",
"0.6288862",
"0.6288237",
"0.62723845",
"0.6270232",
"0.6266264",
"0.6236312",
"0.62331766",
"0.6230732",
"0.6227355",
"0.62255573",
"0.62193114",
"0.62100005",
"0.62100005",
"0.6209173",
"0.61889565",
"0.61842215",
"0.61842215",
"0.6174943",
"0.61648506",
"0.6164029",
"0.61623734",
"0.61607224",
"0.6154204",
"0.614404",
"0.6143825",
"0.6121641",
"0.61092746",
"0.6108666",
"0.6104752",
"0.6101899",
"0.61009085",
"0.6088788",
"0.60843056",
"0.6080495",
"0.6080495",
"0.6068674",
"0.6060713",
"0.6057074",
"0.6052395",
"0.6045617",
"0.60445756"
] | 0.0 | -1 |
Returns the hrefs of all links matching the given css attribute (don't forget the a selector !) | def linked_hrefs(css_selector, strip_spaces = true)
lnks = css(css_selector)
ret = []
for l in lnks
if l['href']
url = l['href']
if strip_spaces
url.gsub!(/\s/,'')
end
ret << normalize_url(url)
end
end
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links\n @doc.css('a[href]').map do |a|\n parse_element_attribute_uri(a, 'href')\n end.compact.uniq\n end",
"def href_parse\n href_elems = @parsed_page.css('a[href]')\n href_elems.map do |elem|\n elem.attributes['href'].value\n end\n end",
"def href_parser(selector_attr, attrb)\n href_elems = @parsed_page.css(selector_attr)\n href_elems.map do |elem|\n elem.attributes[attrb].value\n end\n end",
"def links\n @links ||= begin\n if doc\n # get a list of distinct links on the page, in absolute url form\n links = doc.css('a[href]').inject([]) do |list, link|\n href = link.attributes['href'].content\n href.strip! if href\n \n unless skip_link?(href)\n begin\n url = to_absolute(href)\n rescue URI::InvalidURIError\n $stderr.puts \"ERROR: bad URI #{href.inspect} on page #{self.url.to_s.inspect}\"\n else\n list << url if url.scheme =~ /^https?$/\n end\n end\n list\n end\n \n links.uniq!\n links\n else\n []\n end\n end\n end",
"def links\n return @links unless @links.nil?\n @links = []\n return @links if !doc\n\n doc.search(\"//a[@href]\").each do |a|\n next if a['data-method'] && a['data-method'] != 'get'\n u = a['href']\n next if u.nil? or u.empty?\n abs = to_absolute(u) rescue next\n @links << abs if in_domain?(abs)\n end\n @links.uniq!\n @links\n end",
"def find_links(url)\n # This should return an array of all links at the given URL\n # Can be done using Nokogiri's css OR xpath methods\n #links = page.xpath('//a[@href]').map\n #links = page.xpath('//@href').map(&:value)\n links = []\n doc = Nokogiri::HTML(open(url))\n doc.css('a').each do |a_tag| #doc.css('a') is Nokogiri::XML::NodeSet\n href_str = String(a_tag['href']) # converting to String in case if it is NilClass type\n if href_str.include? \"http\"\n links.push(a_tag['href'])\n end \n end\n links\nend",
"def printcre(criteria, target)\n list = $page.css(\"a[#{criteria} = #{target}]\")\n list.each do |item|\n puts item['href']\n end\nend",
"def get_hrefs\n # this will grab all the html from the url that\n # the user created the scraper with\n url_to_scrape = HTTParty.get(self.url)\n # nokogiri turns everything from HTTParty into nodes.\n nodes = Nokogiri::HTML(url_to_scrape)\n nodes.css('a').each do |a|\n self.hrefs << a['href']\n end\n self.hrefs\n end",
"def find_links_to(url, &block)\n url, selector = if url.kind_of? Array\n [url[1], url[0]]\n else\n [url, 'a']\n end\n \n links = (@data/selector).find_all do |link|\n link[:href].match(strip_url_params(url)) if link and link[:href]\n end\n \n links = links.compact.collect { |link| [link[:href], link.inner_text] }.uniq[0..@_hits - 1]\n \n links.collect do |link|\n yield link[0]\n end\n end",
"def extract_links\n content.css('a').map { |a| a['href'] unless a['href'] == '#' }.compact.uniq\n end",
"def link(attribute)\n links.find_all { |l| l.rel == attribute.to_s }\n end",
"def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend",
"def links\n @data.links ||= parsed_document.search(\"//a\") \\\n .map {|link| link.attributes[\"href\"] \\\n .to_s.strip}.uniq rescue nil\n end",
"def collect_links(html)\n Hash[Nokogiri::HTML(html).css('a').collect {|node| [node.text.strip, node.attributes['href'].to_s]}]\n end",
"def links\n return @links if (defined?(@links) && [email protected]?)\n @links = Nokogiri::HTML.parse(@html).css('a')\n @links = @links.map {|link| link.attribute('href').to_s}\n @links = @links.delete_if{ |link| (link.nil? || link.to_s == '') }\n\n # remove non-HTTP links\n @links = @links.delete_if{|x| x if !x.match(\"http\")}\n\n # handle HTTP redirect links\n # i.e. 'http://www.google.com/?=http://www.cats.com'\n @links = @links.map{|x| \"http\" + x.split(\"http\").last}.compact\n\n # Remove URL params from links\n @links = @links.map{|x| x.split(/\\?|\\&/).first}.compact\n\n # Sanitize links\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n\n # Remove link proxies(i.e. from Google) & decode URI again\n if url.match(/google\\.com/i)\n @links = @links.map{|x| x.split(\"%2b\").first}.compact\n @links = @links.map{|x| URI.decode(x).downcase.strip}.compact\n end\n\n return @links.uniq\n end",
"def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end",
"def get_links(url)\n @driver.get(url)\n data = @driver.execute_script(\"return document.getElementsByTagName('html')[0].innerHTML\")\n\n Nokogiri::HTML(data).css(\"a\").map do |link|\n if (href = link.attr(\"href\"))\n res = Link.new\n\n begin\n res.href = self.build_careers_page_url(url, href.strip).to_s\n rescue\n res.href = nil\n end\n res.text = link.text\n res\n end\n end.compact.reject do |link|\n link.href.nil?\n end.uniq\n end",
"def links(doc)\n links = []\n doc.search(\"//a[@href]\").each do |a|\n u = a['href']\n next if u.nil? or u.empty?\n links << u\n end\n links.uniq!\n links\n end",
"def each_hyperlink # :yields: text\n links = []\n each_hyperlink_attribute {|elem, attr, hyperlink|\n yield hyperlink\n }\n end",
"def extract_all_links(html, base)\n base_url = URI.parse(base)\n doc = Nokogiri::HTML(html)\n links = []\n doc.css(\"a\").each do |node|\n \n begin\n uri = URI(node['href'])\n if uri.absolute? and uri.scheme != \"javascript\" \n links << uri.to_s\n elsif uri.path.start_with?(\"/\")\n uri = base_url + uri\n end\n rescue\n # don't do anything\n end\n end \n links.uniq\n end",
"def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end",
"def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end",
"def get_all_urls\r\n val_d_oise = \"http://annuaire-des-mairies.com/val-d-oise.html\"\r\n page = Nokogiri::HTML(URI.open(val_d_oise))\r\n links = page.xpath('//*[@class=\"lientxt\"]').map{|anchor| anchor[\"href\"]}\r\n return links\r\nend",
"def update_hrefs(css_selector)\n @doc.css(css_selector + ' a').each do |a|\n\n href = Flatfish::Url.absolutify(a['href'], @cd)\n\n # Create tokens for internal links and images/files\n if href =~ /#{@accepted_domain}/\n # NB: the brackets will be URL encoded, so we are flagging them here and gsubbing them before saving\n if @file_whitelist.include?(File.extname(href))\n media = get_media(href)\n href = \"[FLATFISHmedia:#{media.id}FLATFISH]\"\n elsif href !~ /mailto:/\n link = Flatfish::Link.find_or_create_by(url: href)\n href = \"[FLATFISHlink:#{link.id}FLATFISH]\"\n end\n end\n a['href'] = href\n end\n end",
"def find_matches(array, selector, attribute)\n if attribute.kind_of? String or attribute.kind_of? Symbol\n @doc.css(selector).each do |tag|\n begin\n array << Addressable::URI.parse(tag[attribute]).to_s\n rescue\n end\n end\n elsif attribute.instance_of? Regexp\n @doc.css(selector).each do |tag|\n begin\n tag.content.scan(attribute) {|match| array << Addressable::URI.parse(match[0]).to_s}\n rescue\n end\n end\n elsif attribute.instance_of? Proc\n @doc.css(selector).each do |tag|\n begin\n attribute.call(array, tag)\n rescue\n end\n end\n end\n end",
"def links()\n links = Nokogiri::HTML(RedCloth.new(self.body).to_html).css(\"a\").map do |link|\n if (href = link.attr(\"href\")) && href.match(/^https?:/)\n href\n end\n end.compact\n uris = []\n links.each do |link|\n puts link\n uris.push(URI.parse(link))\n end\n return uris\n end",
"def find_links(page)\n links = []\n for link in page.links\n canonical = \"\"\n if /\\Ahttps?/.match(link.href.to_s)\n canonical = canonical + link.href.to_s\n else\n base = page.uri.scheme + \"://\" + page.uri.host\n base.chomp!\n begin\n if !link.uri\n next\n end\n canonical = URI.join(base, link.uri.path.to_s).to_s\n rescue URI::InvalidURIError, URI::InvalidComponentError\n next\n end\n end\n canonical.gsub!(/\\/\\z/, \"\")\n links.push(canonical)\n end\n return links\nend",
"def find_links(url)\n # This should return an array of all links at the given URL\nend",
"def process_anchor_tags(html)\n content = Nokogiri::HTML::DocumentFragment.parse(html)\n anchors = content.css(\"a[href]\")\n anchors.each do |item|\n if processable_link?(item)\n add_target_blank_attribute(item)\n add_rel_attributes(item)\n add_css_classes_if_required(item)\n end\n next\n end\n content.to_html\n end",
"def get_all_the_urls_of_val_doise_townhalls(page_url)\n doc = Nokogiri::HTML(open(page_url))\n urls = []\n#on recupere le css a[class=lientxt]\n get_urls = doc.css(\"a[class=lientxt]\")\n get_urls.each{|link| urls.push(\"http://annuaire-des-mairies.com\"+link['href'][1...link['href'].length])}\n urls\nend",
"def list_links(args = {})\n if args.empty?\n links\n else\n links.select { |link| link.match? args }\n end\n end",
"def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend",
"def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend",
"def get_all_the_urls_of_val_doise_townhalls\n urls = []\n\n directory = Nokogiri::HTML(open('http://annuaire-des-mairies.com/val-d-oise.html'))\n directory.css('a[class = lientxt]').each do |element|\n # element => <a class=\"lientxt\" href=\"./95/nom-de-la-ville.html\">NOM DE LA VILLE</a>\n link = element['href']\n link[0] = ''\n urls << \"http://annuaire-des-mairies.com#{link}\"\n end\n\n urls\nend",
"def query(selector, attr, *filters)\n (filters.any? ? doc.search(*filters).css(selector) : doc.css(selector))\n .map { |node| URI.join(uri, node.attr(attr)) rescue nil }\n .find_all { |uri| uri.is_a?(URI) }\n .uniq\n end",
"def get_all_pages()\n a_links = self.xpath('//tr[1]/td/table/tr/td/a/@href')\n a_links.map {|a_link| a_link.value}\n end",
"def each_hyperlink # :yields: text\n each_hyperlink_attribute {|elem, attr, hyperlink|\n yield hyperlink\n }\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def get_all_links_as_hash(page)\n parsed_page = Nokogiri::HTML(page)\n links = parsed_page.css('a')\n\n all_links = Hash[links.xpath('//a[@href]').map {|link| [link.text.strip, link['href']]}]\n\n return all_links\nend",
"def return_links_array(doc)\n links = doc.css(\".search-content .teaser-item__title a\")\n recipe_links = []\n links.each do |element|\n recipe_links << \"https://www.bbcgoodfood.com\" + element.attribute('href').value\n end\n return recipe_links\n end",
"def select_eo_links(irs_doc)\n irs_doc.xpath('//a/@href').select { |link| link.to_s =~ LINK_REGEX }.map(&:to_s)\n end",
"def fetch_page_links(uri)\n Nokogiri::HTML(open(uri).read).css(\"a\").map do |link|\n if (href = link.attr(\"href\"))\n href\n end\n end.compact\n rescue Exception => ex\n log \"Unhandled exception while fetching links of #{uri}\"\n log \"Error fetching links of #{uri}\"\n log ex.class\n log ex.message\n return []\n end",
"def get_all_the_urls_of_val_doise_townhalls\n mairie_val_d_oise = Array.new\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n links = page.css('a.lientxt')\n links.each do |mairie|\n mairie_val_d_oise << mairie['href']\n end\n return mairie_val_d_oise\nend",
"def links\n return unless success? and body\n\n doc = Nokogiri::HTML(@body)\n \n links = []\n\n doc.css('div.list-lbc a').each do |a|\n link = {\n :url => a['href'],\n :title => a.css('div.title').first.content.strip\n }\n\n link[:ad_id] = link[:url][/^http:\\/\\/www.leboncoin.fr\\/locations\\/(\\d+).*/,1]\n links << link\n yield link if block_given?\n end\n\n links\n end",
"def links_for(href_or_rel)\n rel = @namespace_manager.curie(href_or_rel) || href_or_rel\n @links.select { |link| link.rel == rel }\n end",
"def get_page_urls(page)\n anchors = []\n for _a in page.xpath('.//a[@href]')\n next if (_a['href'].nil? || _a['href'].empty?)\n uri = URI.parse(_a['href'])\n if (uri.query)\n query = Hash[*uri.query.split('&').map{ |_q| a,b = _q.split('='); [a, b || nil] }.flatten]\n anchors << uri if ((uri.path =~ /member_index/) && (query['sort'] == nil) && (query['s'].to_i > 0))\n end\n end\n anchors.map{ |_a| URI::join(SITE, _a.to_s) }.uniq\nend",
"def href_attribute_node_set(nokogiri_xml_element)\n nokogiri_xml_element.xpath(XPATH[:href_attribute])\n end",
"def dropdown_list_items_urls(list)\n css_select(list, \"a\").map do |item|\n item.attributes['href'].try(:value) || \"\"\n end\n end",
"def scrape_page_for_zip_hrefs(url)\n doc = Nokogiri::HTML(open(url))\n array_of_href = []\n doc.css('td a').each do |link|\n array_of_href << url+link['href'] if link['href'].include? \"zip\"\n end\n array_of_href\nend",
"def extract_group_links\n # this one works to extract the group node container:\n #\n # group_list_node = mahara_dashboard_page.css('#groups').each do |node|\n # ...\n # end\n #\n # However, I decided to go the easy way here with some knowledge on how the url must look like\n\n return @mahara_dashboard_page.links_with(:href => /mahara\\/group\\/view/)\n end",
"def get_astronomy_pages()\n\treturn @archive_doc.css('body b a').map { |page| @base_url + page[\"href\"] }\nend",
"def scrape_links(parsed_page, core_path)\n links = []\n \n parsed_page.css('#class-index').css('.entries').css('a').each do |link|\n link_data = Hash.new\n \n link_data[:title] = link.text\n link_data[:path] = core_path + link.attributes['href'].value\n \n links << link_data\n end\n \n links\nend",
"def each_link(&block)\n return enum_for(__method__) unless block_given?\n\n each_body do |content_type,body|\n mime_type = MIME::Type.new(content_type)\n\n case mime_type.sub_type\n when 'html', 'xhtml'\n Nokogiri::HTML(body).search('//a[@href]').each do |a|\n yield a.attr('href')\n end\n when 'plain'\n URI.extract(body,['http','https'],&block)\n end\n end\n end",
"def list\n extract_names_and_urls = lambda do |doc|\n [extact_url(@url, document), extract_titles(document)]\n end\n \n html.css('a').map(&extract_names_and_urls)\n end",
"def get_links(url)\n # catch 404 error from host\n\n doc = Nokogiri::HTML(open(url))\n # find internal links on page\n doc.css('#tagCloud a').each do |link|\n link = link.attr('href')\n # If link correspond to a recipe we add it to recipe to scraw\n if link.include?(ALLOWED_URLS[@host]) && !@crawled_urls.include?(url)\n @to_crawl_urls << link\n end\n end\n @to_crawl_urls.delete url\n @crawled_urls << url\n @to_crawl_urls.uniq!\n rescue OpenURI::HTTPError\n @to_crawl_urls.delete url\n warn \"#{url} cannot be reached\"\n end",
"def link_attribute_list(attribute, separator = nil)\n links.map {|link| link.send(attribute).split(separator)}.flatten.uniq.sort\n end",
"def links\n each_link.to_set\n end",
"def links\n @links ||= parsed_links.map{ |l| absolutify_url(unrelativize_url(l)) }.compact.uniq\n end",
"def auto_link_urls(text, html_options = {})\n extra_options = Mash.new(html_options).to_html_attributes\n extra_options = \" #{extra_options}\" unless extra_options.blank?\n\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end",
"def all_links(options = {}) \n options[:valid_schemes] = [:http, :https] unless options.has_key? :valid_schemes\n data = link_data\n links = data.keys.map{|key| data[key]}.flatten.uniq\n links = links.map{|link| UriHelper.join_no_fragment(@url, link).to_s }\n links = links.reject{|link| link =~ /\\/([^\\/]+?)\\/\\1\\// }\n links = links.reject{|link| link =~ /([^\\/]+?)\\/([^\\/]+?)\\/.*?\\1\\/\\2/ } \n links = links.select{|link| options[:valid_schemes].include? link.split(':')[0].to_sym}\n links\n end",
"def parse_links(html, ttl)\n doc = Nokogiri::HTML(html)\n doc.css('a').each do |a|\n if a.attribute('name')\n next\n end\n my_ttl = ttl\n href = a.attribute('href').to_s\n # Use URI.join to dispose of nasty relative hrefs\n href = URI.join(@base_url, href).to_s\n\n match = href.match(/(\\w+):/)\n proto = match.captures[0]\n\n if my_ttl > 0\n # Are we http(s)?\n if proto.downcase.start_with?('http')\n # http(s) found so decrement TTL\n my_ttl -= 1\n else\n # not http(s) so add with a ttl of 0\n my_ttl = 0\n end\n end\n # Link parsed so add it to the list\n @links.push({'href' => href, 'ttl' => my_ttl})\n end\n end",
"def links\n if @links.blank?\n @links = []\n link_nodes =\n FeedTools::XmlHelper.combine_xpaths_all(self.channel_node, [\n \"atom10:link\",\n \"atom03:link\",\n \"atom:link\",\n \"link\",\n \"channelLink\",\n \"a\",\n \"url\",\n \"href\"\n ])\n for link_node in link_nodes\n link_object = FeedTools::Link.new\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:href\",\n \"@atom03:href\",\n \"@atom:href\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.href == \"atom10:\" ||\n link_object.href == \"atom03:\" ||\n link_object.href == \"atom:\"\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@href\"\n ], :select_result_value => true)\n end\n if link_object.href.nil? && link_node.base_uri != nil\n link_object.href = \"\"\n end\n begin\n if !(link_object.href =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(link_object.href)\n link_object.href = FeedTools::UriHelper.resolve_relative_uri(\n link_object.href,\n [link_node.base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n link_object.href =\n FeedTools::UriHelper.normalize_url(link_object.href)\n end\n link_object.href.strip! unless link_object.href.nil?\n next if link_object.href.blank?\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:hreflang\",\n \"@atom03:hreflang\",\n \"@atom:hreflang\",\n \"@hreflang\"\n ], :select_result_value => true)\n if link_object.hreflang == \"atom10:\" ||\n link_object.hreflang == \"atom03:\" ||\n link_object.hreflang == \"atom:\"\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@hreflang\"\n ], :select_result_value => true)\n end\n unless link_object.hreflang.nil?\n link_object.hreflang = link_object.hreflang.downcase\n end\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:rel\",\n \"@atom03:rel\",\n \"@atom:rel\",\n \"@rel\"\n ], :select_result_value => true)\n if link_object.rel == \"atom10:\" ||\n link_object.rel == \"atom03:\" ||\n link_object.rel == \"atom:\"\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@rel\"\n ], :select_result_value => true)\n end\n unless link_object.rel.nil?\n link_object.rel = link_object.rel.downcase\n end\n if link_object.rel.nil? && self.feed_type == \"atom\"\n link_object.rel = \"alternate\"\n end\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:type\",\n \"@atom03:type\",\n \"@atom:type\",\n \"@type\"\n ], :select_result_value => true)\n if link_object.type == \"atom10:\" ||\n link_object.type == \"atom03:\" ||\n link_object.type == \"atom:\"\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@type\"\n ], :select_result_value => true)\n end\n unless link_object.type.nil?\n link_object.type = link_object.type.downcase\n end\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:title\",\n \"@atom03:title\",\n \"@atom:title\",\n \"@title\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.title == \"atom10:\" ||\n link_object.title == \"atom03:\" ||\n link_object.title == \"atom:\"\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@title\"\n ], :select_result_value => true)\n end\n # This catches the ambiguities between atom, rss, and cdf\n if link_object.title == link_object.href\n link_object.title = nil\n end\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:length\",\n \"@atom03:length\",\n \"@atom:length\",\n \"@length\"\n ], :select_result_value => true)\n if link_object.length == \"atom10:\" ||\n link_object.length == \"atom03:\" ||\n link_object.length == \"atom:\"\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@length\"\n ], :select_result_value => true)\n end\n if !link_object.length.nil?\n link_object.length = link_object.length.to_i\n else\n if !link_object.type.nil? && link_object.type[0..4] != \"text\" &&\n link_object.type[-3..-1] != \"xml\" &&\n link_object.href =~ /^http:\\/\\//\n # Retrieve the length with an http HEAD request\n else\n link_object.length = nil\n end\n end\n @links = [] if @links.nil?\n @links << link_object\n end\n end\n return @links\n end",
"def post_urls\n arr_hrefs = []\n collect_post_elements.each do |element|\n # there should only be one headline link per post\n if link = element.search( headline_element ).first \n uri = URI.parse link['href']\n uri.fragment = nil\n arr_hrefs << uri.to_s \n end\n end\n\n return arr_hrefs\n end",
"def get_anchor_urls\n result = []\n\n @anchor.getLocations().each do |each|\n result << AnchorUrl.new(\n :url => each.getDownloadURL(),\n :anchor_url_certs => get_certs(each))\n end\n\n return result\n end",
"def search_links(page,content)\n page.links_with( :text => Regexp.new(content, true))\n end",
"def href_regexp\n %r{\\[image-link-to:\\s+(?<url>.*?)\\]}\n end",
"def href\n attributes[:href]\n end",
"def linkReturn(url)\n data = Nokogiri::HTML(open(url))\n links = data.css('div.case')\n allUrl = links.css('h3 a').map { |var| var['href'] }\n allUrl.each do |i|\n puts scraper(i)\n puts ''\n puts i\n end\nend",
"def extract_links(doc)\n (doc/'a').map { |link|\n href = link['href']\n CGI.unescapeHTML(href) if href && href !~ /^#/\n }.compact\n end",
"def get_items_links(uri_arr)\n\t\tlinks = []\n\t\t(1..get_max_page(uri_arr) ).each do |x|\n\t\t links.concat P.get_css_list P.build_uri(uri_arr), '.isolux-thumbnail-name a' \n\t\tend\n\t\t\n\t\tlinks\n\tend",
"def links_group_by(attribute, linkz = links)\n linkz.map { |link| { key: link.send(attribute), link: link } }\n .group_by { |entry| entry[:key] }\n .each { |key, link| link.map! { |l| l[:link] }}\n end",
"def scrape_page_for_links(page)\n page_dom = Nokogiri::HTML(fetch_html(WIKIPEDIA_URL + page))\n page_dom.css('a').map { |link| link['href'] }\n end",
"def get_mag_index_pages(mag_url)\n links = []\n doc = Nokogiri::HTML(open(mag_url, :allow_redirections => :safe)) \n doc.css(\"a[href]\").each do |p|\n if p.attribute('href').to_s.include? \"#issues\"\n links.push(p.attribute('href').to_s)\n end\n end\n # the link of the actual url is not in the array. it needs to be,\n # since this is the first page that index issues.\n links.push(mag_url)\n return links.uniq\nend",
"def links\n @links ||= parsed_links.map{ |l| URL.absolutify(URL.unrelativize(l, scheme), base_url) }.compact.uniq\n end",
"def rss_links \n\t\tdoc.xpath(\"//link[@type=\\\"application/rss+xml\\\"]\").map do |link|\n\t\t\tif link['href'] =~ /^http:\\/\\//\n\t\t\t\tlink['href']\n\t\t\telse\n\t\t\t\t\"#{@url}#{link['href']}\"\n\t\t\tend\n\t\tend\n\tend",
"def stylesheets(*filters)\n query(\"link[rel='stylesheet']\", \"href\", *filters)\n end",
"def crawler(url)\n result = []\n doc = Nokogiri::HTML.parse(open(url))\n row = doc.xpath(\"//tr[4]\").first\n while(row)do\n row_doc = Nokogiri::HTML(row.to_s)\n link = row_doc.xpath(\"//a\").first\n if(link)then\n href = url + link.attribute(\"href\").value\n if(href =~ /\\/$/)then\n result = result + crawler(href)\n else\n result << href\n end\n end\n row = row.next\n end\n return result\n end",
"def crawler(url)\n result = []\n doc = Nokogiri::HTML.parse(open(url))\n row = doc.xpath(\"//tr[4]\").first\n while(row)do\n row_doc = Nokogiri::HTML(row.to_s)\n link = row_doc.xpath(\"//a\").first\n if(link)then\n href = url + link.attribute(\"href\").value\n if(href =~ /\\/$/)then\n result = result + crawler(href)\n else\n result << href\n end\n end\n row = row.next\n end\n return result\n end",
"def scrape(para)\n # need SECTION & PLACENAME from para\n # need to follow embedded href to get DESCRIPTION\n links = para.css(\"a\")\n # puts links.length\n # puts links.text\n\n # grabs href from anchor elements\n links.each{|links| puts links['href']}\n #grabs title from anchor elements\n links.each{|links| puts links['title']}\nend",
"def scrape(para)\n # need SECTION & PLACENAME from para\n # need to follow embedded href to get DESCRIPTION\n links = para.css(\"a\")\n # puts links.length\n # puts links.text\n\n # grabs href from anchor elements\n links.each{|links| puts links['href']}\n #grabs title from anchor elements\n links.each{|links| puts links['title']}\nend",
"def get_names_and_urls(page)\n names_and_urls = []\n for _a in page.xpath('.//a[@href]')\n names_and_urls << _a if ((_a['href'] =~ %r{^/\\w+/$}))\n end\n names_and_urls.map{ |_a| [ _a['href'], _a.content.strip ] }\nend",
"def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\n end\n end\n end",
"def all_a\n result = []\n @pages.each do |page|\n next unless page.page_a_tags\n page.page_a_tags.compact.each do |tag|\n tag[0] = '-' unless tag[0]\n tag[1] = '-' unless tag[1]\n tag[2] = '-' unless tag[2]\n result << [page.page_url, tag[0], tag[1], tag[2]]\n end\n end\n result.compact\n end",
"def get_all_the_urls_of_val_doise_townhalls(page_url)\n tab = []\n doc = Nokogiri::HTML(open(page_url))\n tab_lien = doc.css(\"a\").select{|link| link['class']==\"lientxt\"}\n lien =\"http://annuaire-des-mairies.com/\"\n tab_lien.each{|link| tab.push(lien+link['href'])}\n tab\nend",
"def get_raw_links\n @doc.xpath(LINKS_XPATH).map { |link| link['href'] }\n end",
"def get_uris_by_rel_from_html(resource, rel)\n doc = Nokogiri::HTML(resource)\n links = doc.xpath(\"//*[contains(@rel, \\\"#{rel}\\\")]\")\n uris = links.map {|link| link['href'] }\n end",
"def convert_relative_links(url)\n base_url = doc.css('base').present? ? doc.css('base')[0]['href'] : url.split('?').first \n return if base_url.blank?\n doc.css('a').each do |link|\n link['href'] = converted_link(base_url, link['href'])\n end\n end",
"def each_hyperlink_uri(base_uri=nil) # :yields: hyperlink, uri\n base_uri = URI.parse(base_uri) if String === base_uri\n links = []\n each_hyperlink_attribute {|elem, attr, hyperlink|\n if %r{\\{http://www.w3.org/1999/xhtml\\}(?:base)\\z}i =~ elem.name\n base_uri = URI.parse(hyperlink.to_s)\n else\n links << hyperlink\n end\n }\n if base_uri\n links.each {|hyperlink| yield hyperlink, base_uri + hyperlink.to_s }\n else\n links.each {|hyperlink| yield hyperlink, URI.parse(hyperlink.to_s) }\n end\n end",
"def each_hyperlink_uri(base_uri=nil) # :yields: hyperlink, uri\n base_uri = URI.parse(base_uri) if String === base_uri\n links = []\n each_hyperlink_attribute {|elem, attr, hyperlink|\n if %r{\\{http://www.w3.org/1999/xhtml\\}(?:base)\\z}i =~ elem.name\n base_uri = URI.parse(hyperlink.to_s)\n else\n links << hyperlink\n end\n }\n if base_uri\n links.each {|hyperlink| yield hyperlink, base_uri + hyperlink.to_s }\n else\n links.each {|hyperlink| yield hyperlink, URI.parse(hyperlink.to_s) }\n end\n end",
"def change_hrefs(html)\n DOM.walk(html) do |node|\n for attr_name in %w{href src}\n attr_obj = node.attributes[attr_name]\n\n # Ignore if its blank\n next if !attr_obj\n\n # URL encode any spaces\n orig_href = attr_obj.to_s.gsub(\" \", \"%20\")\n\n begin\n src = URI(orig_href)\n rescue\n log \"#{orig_href} not a valid URI\"\n next\n end\n\n if internal_link?(src.to_s)\n linked_item = nil\n\n if src.path == \"\"\n # If its just an anchor like '#this' just set to the current file\n linked_item = self\n else\n # Match on the unescaped href\n unescaped_path = URI::unescape(src.path)\n linked_item = get_item(unescaped_path)\n end\n\n # Change link\n if linked_item\n new_path = linked_item.normalized_hashed_path(:relative_to => self)\n new_path = URI(new_path)\n\n if src.fragment\n new_path.fragment = src.fragment\n end\n\n log \"Changing #{src.to_s} to #{new_path.to_s}\"\n attr_obj.content = new_path.to_s\n else\n log \"No item in manifest for #{src}\"\n end\n end\n end\n end\n end",
"def find_links(html_code)\n all_links = Array.new\n page = Mechanize::Page.new(nil, nil, html_code, nil, Mechanize.new)\n page.links.each do |link|\n all_links.push(link.href)\n end\n # fill in some code here!\n return all_links\nend",
"def find_links(search)\n links.select { |link| link.contains? search }\n end",
"def get_all_the_urls_of_val_doise_townhalls\n\tdoc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n\tputs doc.xpath('//a[@class = \"lientxt\"]/@href')\nend",
"def get_links(page_url)\n ndoc = Nokogiri::HTML(open(page_url))\n links = ndoc.css('a')\n tmp = []\n found = nil\n links.each do |ln|\n if ln.text == \"next 5,000\"\n tmp = get_links(\"http://en.wikipedia.org\" + ln[\"href\"])\n tmp << \"http://en.wikipedia.org\" + ln[\"href\"]\n found = true\n break\n end\n end\n if found == nil\n tmp << page_url\n end\n tmp\nend",
"def get_position_links\n # Get all links that have the text: \"View Details\"\n links = @page.links_with(:text => /View Details/)\n href_links = []\n # convert all links into an appropriate html link\n links.each { |link| href_links << 'https://www.jobsatosu.com' + link.href }\n href_links\n end",
"def html_filter_annotate_bare_links\n @html.search('a[@href]').each do |node|\n href = node.attributes['href'].content\n text = node.inner_text\n\n next unless href == text || href[0] == '#' ||\n CGI.unescapeHTML(href) == \"mailto:#{CGI.unescapeHTML(text)}\"\n\n node.set_attribute('data-bare-link', 'true')\n end\n end",
"def links(query = {})\n Request.new(self, '/cdn/links', query).get\n end",
"def links(query = {})\n Request.new(self, '/cdn/links', query).get\n end",
"def getCompanyURLs(relativeURL)\n\tdoc = Nokogiri::HTML(open(@baseURL + relativeURL))\n\treturn doc.css('div.left.company_info a:not([onclick])').map { |a| a['href'] }\nend"
] | [
"0.755724",
"0.69653106",
"0.68248546",
"0.6805061",
"0.66520023",
"0.6606846",
"0.6573507",
"0.6469958",
"0.64444256",
"0.64281535",
"0.64194435",
"0.6322513",
"0.63181245",
"0.63096416",
"0.62351394",
"0.6229713",
"0.6218495",
"0.61730546",
"0.61684823",
"0.60782427",
"0.60668504",
"0.60668504",
"0.6056635",
"0.6054859",
"0.6023267",
"0.59603566",
"0.5937879",
"0.59215885",
"0.5899974",
"0.5872549",
"0.5849441",
"0.58479387",
"0.58479387",
"0.5820191",
"0.58097315",
"0.5802226",
"0.57861435",
"0.5767726",
"0.5767726",
"0.5761822",
"0.5761325",
"0.5754227",
"0.5733923",
"0.5726132",
"0.569011",
"0.5675294",
"0.56720316",
"0.566058",
"0.56335914",
"0.55922586",
"0.5570318",
"0.55672836",
"0.5556518",
"0.5537335",
"0.5536372",
"0.55257744",
"0.5488007",
"0.54802096",
"0.5469754",
"0.54465425",
"0.5441695",
"0.543794",
"0.54291046",
"0.5411387",
"0.53751916",
"0.53641045",
"0.5331577",
"0.5311466",
"0.53085476",
"0.52836055",
"0.5280438",
"0.52751863",
"0.5274254",
"0.52642995",
"0.5261436",
"0.52594274",
"0.5242486",
"0.5223756",
"0.5223756",
"0.52221984",
"0.52221984",
"0.52084464",
"0.5203015",
"0.5200472",
"0.52003264",
"0.5188265",
"0.51840323",
"0.51748294",
"0.51686215",
"0.51686215",
"0.5165959",
"0.51639545",
"0.51568824",
"0.51500076",
"0.51306784",
"0.51292145",
"0.51144254",
"0.5095974",
"0.5095974",
"0.5095636"
] | 0.72517 | 1 |
GET /group_comments GET /group_comments.json | def index
@group_comments = GroupComment.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @group_comments = GroupComment.all\n\n render json: @group_comments\n end",
"def show\n render json: @group_comment\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end",
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n if @group_comment.save\n render json: @group_comment, status: :created, location: @group_comment\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def comment\n\t\t# Get the group in question\n\t\tgroup = Group.find(params[:id])\n\n\t\t# Require an authenticated user that has joined the group\n\t\tgroup = Group.find(params[:id])\n\t\traise HTTPStatus::Unauthorized if User.current.nil? || !group.users.include?(User.current)\n\n\t\t# Create the comment\n\t\tcomment = group.create_comment(params[:comment])\n\n\t\t# save and get the proper message\n\t\tif comment.save\n\t\t\tmessage = {:type => :success, :message => \"Successfully added comment.\", :id => comment.id}\n\t\t\tself.log_analytic(:user_comment_in_group, \"User has commented in group.\", comment, [], :groups)\n\t\telse\n\t\t\tmessage = {:type => :error, :message => \"There was an error posting your comment.\"}\n\t\tend\n\n\t\t# Respond with either html or json\n\t\trespond_to do |format|\n\t\t\tformat.html { flash[message[:type]] = message[:message]; redirect_to :back }\n\t\t\tformat.json { render :json => message }\n\t\tend\n\tend",
"def index\n @comments = DiscussionComment.all\n render json: @comments\n end",
"def show\n @comments_open_group_post = CommentsOpenGroupPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comments_open_group_post }\n end\n end",
"def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"def comments; rest_query(:comment); end",
"def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\n end",
"def comments\n render json: @post.comments\n end",
"def gist_comments(id)\n get \"/gists/#{id}/comments\"\n end",
"def show\n authorize @repository\n @tags = @repository.groupped_tags\n serialize_repository\n @repository_comments = @repository.comments.all\n @comments_serialized = API::Entities::Comments.represent(\n @repository.comments.all,\n current_user: current_user,\n type: :internal\n ).to_json\n respond_with(@repository)\n end",
"def all_comments\n render :json => User.find(params[:user_id]).comments\n end",
"def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def show\n @my_group_comment = My::GroupComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_group_comment }\n end\n end",
"def index\n comments = @project.comments\n render json: comments\n end",
"def show\n\tcurrent_page = 1\n\tif params[:page]\n\t\t current_page = params[:page]\n\tend\n\tper_page = 7\n\tif signed_in?\t\n\t\t@group_users = @group.users.paginate(:page => current_page, :per_page=>per_page)\n\t\t#@group_users = WillPaginate::Collection.create( current_page, per_page, @group.users.length) do |pager|\n\t\t\t#pager.replace @group.users #.where('user_id not in (?)', current_user.id)\n\t\t#end\n\n\t\t#@comment = @group.comments.build\n\n\t\t@top_comments = @group.comments.order(created_at: :desc).limit(10)\n\t\t@comment_pages = {}\n\t\tpgs = @group.comments.select('page_number')\n\t\tpgs.each do |p|\n\t\t\t@comment_pages[p.page_number] = true\n\t\tend\n\tend\n end",
"def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end",
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n respond_to do |format|\n if @group_comment.save\n format.html { redirect_to @group_comment, notice: 'Group comment was successfully created.' }\n format.json { render :show, status: :created, location: @group_comment }\n else\n format.html { render :new }\n format.json { render json: @group_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @group = Group.find(params[:id])\n @groupphoto_comments = Comment.find_groupphoto_comments_for(@group) \n @groupphotos = @group.groupphotos.find(:all, :limit => 5)\n \n @comments = @group.comments.find(:all, :limit => 10, :order => 'created_at DESC')\n @groups_comments = Comment.find_group_comments_for(@group)\n \n if @group.owner == current_user\n @is_group_owner = true\n else\n @is_group_owner = false\n end\n\n @member_count = @group.accepted_memberships.count\n @accepted_memberships = @group.accepted_memberships.find(:all, :limit => 5).collect{|f| f.member }\n @pending_memberships_count = @group.pending_memberships.count()\n\n update_view_count(@group) unless @group.owner && current_user.eql?(@group)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def group_info\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory\n .groups\n .where('groups.id = ?', group_id_param)\n .eager_load(:users)\n .first\n if group.nil?\n render json: { error: 'No such group found.' }, status: :not_found\n else\n maillist = get_maillist_for_space(group.id)\n render json: { id: group.id,\n name: group.name,\n description: group.description,\n maillist: maillist,\n leader_id: group.leader_id,\n created_at: group.created_at,\n join_type: display_join_type(group.join_level),\n size: group.users.count\n },\n status: :ok\n end\n end",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end",
"def comments(options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments\", options))\n end",
"def gist_comments(gist_id, params={})\n _normalize_params_keys(params)\n _merge_mime_type(:gist_comment, params)\n\n get(\"/gists/#{gist_id}/comments\", params)\n end",
"def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end",
"def index\n @comments = Comment.all\n render json: @comments\n end",
"def belonging_groups\n contact_groups = []\n @contact.contact_groups.each do |group|\n contact_groups << { _id: group['_id'].to_s, lbl: group['label'] }\n end\n\n respond_to do |format|\n format.js {}\n format.json { render json: contact_groups }\n end\n end",
"def index\n comments = @post.comments\n render json: { comments: comments }\n #loop through comments and find first and last name by user_id\n #User.find....etc\n end",
"def show\n render json: Group.find(params[:id]).contacts\n end",
"def comments(options = {})\n comments_resource(options)\n end",
"def index\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:photo_id])\n @comments = @photo.comments.all\n \n respond_to do |format|\n format.json { render :json => @comments.to_json }\n end\n end",
"def group_comment_params\n params.require(:group_comment).permit(:body, :user_id, :group_id)\n end",
"def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n\n render json: @comments, include: ['user']\n end",
"def comments(options = {})\n options = { query: options } if options.any?\n @party.get(\"forms/#{@id}/comments\", options)['Comments']\n end",
"def get_groups\n @course = Course.find(params[:course_id])\n render json: @course.groups\n end",
"def comments(token,student_id)\n path = \"comments/index\"\n return get_data(token,path,'?student_id=' + student_id.to_s)\n end",
"def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments(options = {})\n urn = options.delete(:urn)\n path = \"/socialActions/#{urn}/comments\"\n get(path, options)\n end",
"def set_group_comment\n @group_comment = GroupComment.find(params[:id])\n end",
"def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def show\n # comment = Comment.find_comment\n render json: @comment\n end",
"def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end",
"def comments(gist_id, params={})\n _normalize_params_keys(params)\n _validate_presence_of(gist_id)\n # _merge_mime_type(:gist_comment, params)\n\n response = get(\"/gists/#{gist_id}/comments\", params)\n return response unless block_given?\n response.each { |el| yield el }\n end",
"def destroy\n @group_comment.destroy\n respond_to do |format|\n format.html { redirect_to group_comments_url, notice: 'Group comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def comments\n @mapped_comments ||= Basecamp3::Comment.all(bucket.id, id)\n end",
"def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def comments(post_id)\n records \"comment\", \"/msg/comments/#{post_id}\"\n end",
"def comments_for(url)\n get_data(\"comments/show/#{FORMAT}?url=#{url}\")\n end",
"def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.comments, status: :ok\n end",
"def new\n @comments_open_group_post = CommentsOpenGroupPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comments_open_group_post }\n end\n end",
"def index\n if params[:_post_id]\n post_comments = PostComment.where(post_id: params[:_post_id])\n render json: post_comments.as_json(\n include: { user: { only: [:name, :id] } },\n except: [:post_id, :user_id]),\n status: :ok\n else\n render json: @current_user.post_comments.as_json(\n include: { post: { only: [:title, :id, :excerpt] } },\n except: [:user_id, :post_id]),\n status: :ok\n end\n end",
"def comments(options={})\n parse_comments(request(singular(answer_id) + \"/comments\", options))\n end",
"def update\n respond_to do |format|\n if @group_comment.update(group_comment_params)\n format.html { redirect_to @group_comment, notice: 'Group comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_comment }\n else\n format.html { render :edit }\n format.json { render json: @group_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @comments = @post.comments.order(created_at: :desc)\n render json: @comments, status: :ok\n\n end",
"def show\n group = Group.find(params[:id])\n\n render json: group\n end",
"def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end",
"def comments\n pull_comments\n @comments_list\n end",
"def list_comment\n user = current_user\n commentaires =Commentaire.all\n comments = []\n commentaires.each do |commentaire|\n if commentaire.user_id == user.id\n {commentaire:commentaire,logement:commentaire.logement,photo_logement:\"#{commentaire.logement.photos.first.photo.url}\",reponses:commentaire.reponses}\n end\n end\n render json: {commentaire:comments}\n end",
"def show\n @discussion = Discussion.includes(:user, { :comments => :user }).find(params[:id])\n @comments = @discussion.comments.paginate page: params[:page]\n @comment = @discussion.comments.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def index\n @comments = @entry.comments\n respond_with(@comments)\n end",
"def comment(options)\n get(\"/content/items/#{options.delete(:item)}/comments/#{options[:id]}\",options)\n end",
"def show\n render json: @contact_group\n end",
"def comments\n @comments = @subject.blinded_comments(current_user).includes(:user, :sheet)\n .order(created_at: :desc).page(params[:page]).per(20)\n end",
"def get_conversation_comments(conversation_id)\n list(\"conversations/#{conversation_id}/comments\")\n end",
"def moment_comments(moment_id)\n get(\"/v1/moments/#{moment_id}/comments\")\n end",
"def show\n render json: @comment\n end",
"def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def comments( params={} )\n comments = get_connections(\"comments\", params)\n return map_connections comments, :to => Facebook::Graph::Comment\n end",
"def comments( params={} )\n comments = get_connections(\"comments\", params)\n return map_connections comments, :to => Facebook::Graph::Comment\n end",
"def get_comments(issue_id_or_key, params = {})\n get(\"issues/#{issue_id_or_key}/comments\", params)\n end",
"def get_comments\n @public_comments = @user_key.comments.public_only.chronological\n @private_comments = @user_key.comments.private_only.chronological\n @comment = @user_key.comments.build\n end",
"def index\n #@discussions = Discussion.where(:owner => nil).order(\"created_at DESC\")\n\t@discussions = Discussion.joins(:comments).\n\t\t\t\t\tselect('discussions.*, count(comments.id) as comments_count').\n\t\t\t\t\twhere(\"discussions.owner IS NULL\").\n\t\t\t\t\tgroup(\"discussions.id\").\n\t\t\t\t\torder('comments_count DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def comments(options={})\n @comments ||= self.class.parse_comments(request(singular(question_id) + \"/comments\", options))\n end",
"def photos_comments(options = {})\n params = { \n :owner_id => user.identifier,\n :count => 100, \n :need_likes => 1,\n :offset => 0\n }\n\n params.merge!(options)\n\n fetch_all_method_items_with_days(\"photos.getAllComments\", params)\n end",
"def list_comments(params = {})\n return false unless check_required_params(params, ['activityId'])\n\n execute_with_api({\n :args => [\n @plus_api.comments.list,\n params\n ]\n })\n end",
"def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end",
"def index\n post = Post.find(params[:post_id])\n comments = post.comments.order(updated_at: :desc)\n @comment = Comment.new\n\n @comments = comments.map do |comment|\n {\n content: comment.content,\n created_at: comment.created_at.strftime('%Y-%m-%d %H:%M:%S')\n }\n end\n\n render json: {\n data: {\n comments: @comments,\n new_comment: @comment,\n }\n }\n end",
"def index\n @groupreplies = Groupreply.where(\"groupmessage_id = ?\", params[:groupmessage_id])\n end",
"def index\n logger.info(\"comments got index! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end",
"def set_comments\n @comments = @photo.comments\n\n if @comments.nil?\n render json: { message: \"Comment not found\" }, status: 404\n end\n end",
"def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id]).order(\"id desc\")\n @comments = @comments.page(params[:page]).per(20)\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def comments\n @uni_module = UniModule.find(params[:id])\n @comments = @uni_module.comments\n \n if params[:per_page].present? && params[:per_page].to_i > 0\n @per_page = params[:per_page].to_i\n else\n @per_page = 20\n end\n\n if params[:sortby].present? && params[:order].present? \n @sort_by = params[:sortby]\n @order = params[:order]\n @comments = sort(Comment, @comments, @sort_by, @order, @per_page, \"created_at\")\n @comments = Kaminari.paginate_array(@comments).page(params[:page]).per(@per_page)\n\n\n else\n @comments = @comments.order('created_at ASC').page(params[:page]).per(@per_page)\n end\n\n\n end",
"def comments\n if @comment_feed.comments.nil?\n @comment_feed.fetch\n end\n\n @comment_feed.comments\n end",
"def new\n @my_group_comment = My::GroupComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_group_comment }\n end\n end",
"def show_group\n\t\t@student = Student.find(params[:student_id])\n\t\trender json: @student.groups.find_by(course_id: params[:course_id])\n\tend",
"def get_comments(channel_name)\n uri = create_api_uri(@@base_uri, channel_name, 'getComments')\n return get(uri)\n end",
"def index\n @comments = Comment.order(\"created_at DESC\")\n render json: @comments, status: :ok\n end",
"def get_comments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmailsApi#get_comments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_comments\" if id.nil?\n \n # resource path\n local_var_path = \"/Emails/{id}/Comments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<InlineResponse2001>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmailsApi#get_comments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list \n @comment = Comment.all\n end"
] | [
"0.78691083",
"0.75575876",
"0.7219774",
"0.67327315",
"0.67327315",
"0.66567445",
"0.6612792",
"0.6608286",
"0.6593954",
"0.65640074",
"0.65195",
"0.6500414",
"0.63990015",
"0.63872886",
"0.63727844",
"0.63663155",
"0.63621545",
"0.6339159",
"0.63308865",
"0.63188297",
"0.62505925",
"0.6250068",
"0.6203838",
"0.61982423",
"0.6191229",
"0.6180254",
"0.6153336",
"0.61274254",
"0.61002403",
"0.6092002",
"0.6078391",
"0.60744655",
"0.6073172",
"0.60708773",
"0.6067541",
"0.6063066",
"0.6062612",
"0.60598785",
"0.60586256",
"0.60401744",
"0.602212",
"0.6013383",
"0.60127914",
"0.60127914",
"0.60127914",
"0.60088754",
"0.600567",
"0.59946805",
"0.5988438",
"0.5988115",
"0.5985525",
"0.59774125",
"0.5962791",
"0.59576386",
"0.5957179",
"0.5953586",
"0.5950061",
"0.59214026",
"0.58981943",
"0.5895104",
"0.58905464",
"0.5868386",
"0.58619565",
"0.58600426",
"0.585832",
"0.5856508",
"0.5856017",
"0.58509284",
"0.58469373",
"0.5843984",
"0.5842214",
"0.584161",
"0.5840303",
"0.58391076",
"0.58349776",
"0.58331555",
"0.5829678",
"0.5827479",
"0.582649",
"0.582649",
"0.5821974",
"0.58182234",
"0.581804",
"0.58106136",
"0.5800176",
"0.579636",
"0.57903206",
"0.57893234",
"0.57875794",
"0.5779793",
"0.5775881",
"0.5775286",
"0.57732946",
"0.5772237",
"0.5758301",
"0.57508725",
"0.5750666",
"0.5748941",
"0.574301",
"0.5730375"
] | 0.72937405 | 2 |
GET /group_comments/1 GET /group_comments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @group_comments = GroupComment.all\n\n render json: @group_comments\n end",
"def show\n render json: @group_comment\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def index\n @group_comments = GroupComment.all\n end",
"def show\n @comments_open_group_post = CommentsOpenGroupPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comments_open_group_post }\n end\n end",
"def index\n @comments = DiscussionComment.all\n render json: @comments\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comment\n\t\t# Get the group in question\n\t\tgroup = Group.find(params[:id])\n\n\t\t# Require an authenticated user that has joined the group\n\t\tgroup = Group.find(params[:id])\n\t\traise HTTPStatus::Unauthorized if User.current.nil? || !group.users.include?(User.current)\n\n\t\t# Create the comment\n\t\tcomment = group.create_comment(params[:comment])\n\n\t\t# save and get the proper message\n\t\tif comment.save\n\t\t\tmessage = {:type => :success, :message => \"Successfully added comment.\", :id => comment.id}\n\t\t\tself.log_analytic(:user_comment_in_group, \"User has commented in group.\", comment, [], :groups)\n\t\telse\n\t\t\tmessage = {:type => :error, :message => \"There was an error posting your comment.\"}\n\t\tend\n\n\t\t# Respond with either html or json\n\t\trespond_to do |format|\n\t\t\tformat.html { flash[message[:type]] = message[:message]; redirect_to :back }\n\t\t\tformat.json { render :json => message }\n\t\tend\n\tend",
"def show\n @my_group_comment = My::GroupComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_group_comment }\n end\n end",
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n if @group_comment.save\n render json: @group_comment, status: :created, location: @group_comment\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def gist_comments(id)\n get \"/gists/#{id}/comments\"\n end",
"def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def comments; rest_query(:comment); end",
"def index\n comments = @project.comments\n render json: comments\n end",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def comments\n render json: @post.comments\n end",
"def set_group_comment\n @group_comment = GroupComment.find(params[:id])\n end",
"def show\n # comment = Comment.find_comment\n render json: @comment\n end",
"def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end",
"def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end",
"def all_comments\n render :json => User.find(params[:user_id]).comments\n end",
"def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\n end",
"def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end",
"def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end",
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n respond_to do |format|\n if @group_comment.save\n format.html { redirect_to @group_comment, notice: 'Group comment was successfully created.' }\n format.json { render :show, status: :created, location: @group_comment }\n else\n format.html { render :new }\n format.json { render json: @group_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n comments = @post.comments\n render json: { comments: comments }\n #loop through comments and find first and last name by user_id\n #User.find....etc\n end",
"def show\n @comment = @commentable.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"def show\n comment = Comment.find(params[:id])\n render json: comment, status: 200\n end",
"def show\n authorize @repository\n @tags = @repository.groupped_tags\n serialize_repository\n @repository_comments = @repository.comments.all\n @comments_serialized = API::Entities::Comments.represent(\n @repository.comments.all,\n current_user: current_user,\n type: :internal\n ).to_json\n respond_with(@repository)\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end",
"def show\n @discussion = Discussion.includes(:user, { :comments => :user }).find(params[:id])\n @comments = @discussion.comments.paginate page: params[:page]\n @comment = @discussion.comments.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end",
"def comment(options)\n get(\"/content/items/#{options.delete(:item)}/comments/#{options[:id]}\",options)\n end",
"def show\n comment = Comment.find_by(id: params[:id])\n render json: comment\n end",
"def show\n comment = Comment.find(params[:id])\n render json: comment, status: :ok\n end",
"def comments(token,student_id)\n path = \"comments/index\"\n return get_data(token,path,'?student_id=' + student_id.to_s)\n end",
"def comments_for(url)\n get_data(\"comments/show/#{FORMAT}?url=#{url}\")\n end",
"def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def new\n @comments_open_group_post = CommentsOpenGroupPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comments_open_group_post }\n end\n end",
"def show\n\tcurrent_page = 1\n\tif params[:page]\n\t\t current_page = params[:page]\n\tend\n\tper_page = 7\n\tif signed_in?\t\n\t\t@group_users = @group.users.paginate(:page => current_page, :per_page=>per_page)\n\t\t#@group_users = WillPaginate::Collection.create( current_page, per_page, @group.users.length) do |pager|\n\t\t\t#pager.replace @group.users #.where('user_id not in (?)', current_user.id)\n\t\t#end\n\n\t\t#@comment = @group.comments.build\n\n\t\t@top_comments = @group.comments.order(created_at: :desc).limit(10)\n\t\t@comment_pages = {}\n\t\tpgs = @group.comments.select('page_number')\n\t\tpgs.each do |p|\n\t\t\t@comment_pages[p.page_number] = true\n\t\tend\n\tend\n end",
"def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end",
"def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id]).order(\"id desc\")\n @comments = @comments.page(params[:page]).per(20)\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def index\n @comments = Comment.all\n render json: @comments\n end",
"def show\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment1 }\n end\n end",
"def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end",
"def show\n @group = Group.find(params[:id])\n @groupphoto_comments = Comment.find_groupphoto_comments_for(@group) \n @groupphotos = @group.groupphotos.find(:all, :limit => 5)\n \n @comments = @group.comments.find(:all, :limit => 10, :order => 'created_at DESC')\n @groups_comments = Comment.find_group_comments_for(@group)\n \n if @group.owner == current_user\n @is_group_owner = true\n else\n @is_group_owner = false\n end\n\n @member_count = @group.accepted_memberships.count\n @accepted_memberships = @group.accepted_memberships.find(:all, :limit => 5).collect{|f| f.member }\n @pending_memberships_count = @group.pending_memberships.count()\n\n update_view_count(@group) unless @group.owner && current_user.eql?(@group)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def get_comment(comment_id)\n get(\"comments/#{comment_id}\")\n end",
"def show\n render json: @comment\n end",
"def show\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end",
"def comments(options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments\", options))\n end",
"def index\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:photo_id])\n @comments = @photo.comments.all\n \n respond_to do |format|\n format.json { render :json => @comments.to_json }\n end\n end",
"def gist_comments(gist_id, params={})\n _normalize_params_keys(params)\n _merge_mime_type(:gist_comment, params)\n\n get(\"/gists/#{gist_id}/comments\", params)\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def show\n @comment = Comment.find(params[:id])\n render json:@comment\n end",
"def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end",
"def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n\n render json: @comments, include: ['user']\n end",
"def gist_comment(id, comment_id)\n get \"/gists/#{id}/comments/#{comment_id}\"\n end",
"def get_comment\n @comment = Comment.find(params[:id])\n end",
"def comments(post_id)\n records \"comment\", \"/msg/comments/#{post_id}\"\n end",
"def new\n @my_group_comment = My::GroupComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_group_comment }\n end\n end",
"def show\n render json: @comment, status: :ok\n\n end",
"def show\n #@post = Post.find(params[:id])\n @comment = Comment.new\n @comment_container_id_prefix = COMMENT_CONTAINER_ID_PREFIX\n respond_to do |format|\n format.html\n format.json { render json: @post, except: :updated_at, :include => {:user => {:only => [:name]}}}\n end\n end",
"def show\n @project_comment = ProjectComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project_comment }\n end\n end",
"def show\n @messages_comment = MessagesComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messages_comment }\n end\n end",
"def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\n end",
"def show\n @new_comment = Comment.build_from(@post, \"\")\n\n render json: @post, status: 200\n\n\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.comments, status: :ok\n end",
"def comments_show\n @guest = Guest.new\n @project = Project.find(params[:id])\n @npo = Npo.find_by_account_id(@project.account_id)\n @comments = Comment.find_all_by_project_id(@project.id)\n @twitter = get_twitter(@npo)\n render \"projects/project_comments_show\"\n end",
"def comments(options = {})\n comments_resource(options)\n end",
"def comment(comment_id, params={})\n _normalize_params_keys(params)\n _validate_presence_of(comment_id)\n # _merge_mime_type(:gist_comment, params)\n\n get(\"/gists/comments/#{comment_id}\", params)\n end",
"def show\n @comment = Comment.new\n @comments = Comment.get_post_comments @post\n if session[:comment_errors]\n session[:comment_errors].each {|error, error_message| @comment.errors.add error, error_message}\n session.delete :comment_errors\n end\n respond_to do |format|\n format.html\n format.json { render :json => {:post => @post, :comments => @comments, :status => 200} }\n end\n end",
"def get(gist_id, comment_id, params={})\n normalize! params\n assert_presence_of comment_id\n # _merge_mime_type(:gist_comment, params)\n\n get_request(\"/gists/#{gist_id}/comments/#{comment_id}\", params)\n end",
"def index\n @comments = @entry.comments\n respond_with(@comments)\n end",
"def comments(options = {})\n options = { query: options } if options.any?\n @party.get(\"forms/#{@id}/comments\", options)['Comments']\n end",
"def set_comment\n @group = Group.find(params[:group_id])\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:id])\n end",
"def show\n render json: comment\n end",
"def show\n @post = Post.find(params[:id], include: :comments, order: 'comments.id')\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @comments = @post.comments.order(created_at: :desc)\n render json: @comments, status: :ok\n\n end",
"def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end",
"def comments\n pull_comments\n @comments_list\n end",
"def show\n group = Group.find(params[:id])\n\n render json: group\n end",
"def getComment(response)\r\n\t\t\t\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\t\r\n\t\t\t\tcomments = jsonObject[\"comments\"]\r\n\t\t\t\t\t\r\n\t\t\t\treturn jsonToComment(comments[0])\r\n\t\t\t\r\n\t\t\tend",
"def get_comments(issue_id_or_key, params = {})\n get(\"issues/#{issue_id_or_key}/comments\", params)\n end",
"def refresh!\n body = get(\"/comments/#{id}.json\").body\n @comments = client.object_from_body(body[1])\n deep_merge!(body[0])\n end",
"def show\n @comment = Comment.new(contribution_id: params[:id])\n @comments = Comment.where(\"contribution_id=\" + (params[:id])).order(\"created_at DESC\")\n end",
"def index\n if params[:_post_id]\n post_comments = PostComment.where(post_id: params[:_post_id])\n render json: post_comments.as_json(\n include: { user: { only: [:name, :id] } },\n except: [:post_id, :user_id]),\n status: :ok\n else\n render json: @current_user.post_comments.as_json(\n include: { post: { only: [:title, :id, :excerpt] } },\n except: [:user_id, :post_id]),\n status: :ok\n end\n end",
"def create\n comment = Comment.new(comment_params)\n\n post = Post.find(params[:comment][:post_id])\n post.data[\"comments\"] = post.data[\"comments\"] + 1\n\n if comment.save && post.save\n render json: {\n status: \"success\",\n data: {\n comment: comment.as_json(include: {\n user: {\n only: [:id, :name, :avatar]\n }\n }),\n comments: post.data[\"comments\"]\n }\n }, status: :ok\n else\n render json: comment.errors, status: 404\n end\n end",
"def show\n recipe = Recipe.find_by_id(params[:id])\n\n respond_to do |format|\n if recipe\n @comments = []\n comments = recipe.comments\n for comment in comments\n comment_user = comment.user\n @comments << { :user => comment_user, :profile_picture => comment_user.profile_picture.url, :comment => comment }\n end\n\n format.json { render :json => @comments }\n else\n format.json { render :status => 404, :json => { :message => \"No such Recipe\"}}\n end\n end\n end",
"def comments(gist_id, params={})\n _normalize_params_keys(params)\n _validate_presence_of(gist_id)\n # _merge_mime_type(:gist_comment, params)\n\n response = get(\"/gists/#{gist_id}/comments\", params)\n return response unless block_given?\n response.each { |el| yield el }\n end",
"def destroy\n @group_comment.destroy\n respond_to do |format|\n format.html { redirect_to group_comments_url, notice: 'Group comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n render json: Group.find(params[:id]).contacts\n end",
"def set_group_message_comment\n @group_message_comment = GroupMessageComment.find(params[:id])\n end",
"def index\n #@discussions = Discussion.where(:owner => nil).order(\"created_at DESC\")\n\t@discussions = Discussion.joins(:comments).\n\t\t\t\t\tselect('discussions.*, count(comments.id) as comments_count').\n\t\t\t\t\twhere(\"discussions.owner IS NULL\").\n\t\t\t\t\tgroup(\"discussions.id\").\n\t\t\t\t\torder('comments_count DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def group_comment_params\n params.require(:group_comment).permit(:body, :user_id, :group_id)\n end",
"def set_comments\n @comments = @photo.comments\n\n if @comments.nil?\n render json: { message: \"Comment not found\" }, status: 404\n end\n end"
] | [
"0.76471514",
"0.75349224",
"0.72888666",
"0.7225389",
"0.68266976",
"0.66935647",
"0.6645439",
"0.6645439",
"0.6599492",
"0.65860945",
"0.65777653",
"0.65206116",
"0.6497984",
"0.64764535",
"0.64731354",
"0.64413047",
"0.6438477",
"0.63444054",
"0.63395834",
"0.6337236",
"0.63346416",
"0.63262075",
"0.63172543",
"0.6313318",
"0.6290127",
"0.62254596",
"0.62235373",
"0.62123543",
"0.6207791",
"0.62062526",
"0.62045616",
"0.6204145",
"0.6196078",
"0.618151",
"0.6170861",
"0.6166054",
"0.6163104",
"0.61525816",
"0.6151264",
"0.6150341",
"0.6142202",
"0.61352634",
"0.6130881",
"0.61274475",
"0.6117941",
"0.61163306",
"0.6105481",
"0.6104923",
"0.610056",
"0.6098813",
"0.6093915",
"0.60840374",
"0.6079625",
"0.6069858",
"0.60648715",
"0.6063549",
"0.6061167",
"0.6061167",
"0.6061167",
"0.60524917",
"0.6048845",
"0.6035982",
"0.60263944",
"0.6025398",
"0.60093766",
"0.60065466",
"0.5999023",
"0.5998603",
"0.59956676",
"0.5994426",
"0.59926957",
"0.5981041",
"0.5979693",
"0.5979595",
"0.5970436",
"0.5970391",
"0.59602904",
"0.5952017",
"0.59506506",
"0.5947956",
"0.5946538",
"0.59461856",
"0.5939519",
"0.593499",
"0.5933216",
"0.59273666",
"0.5917042",
"0.5915202",
"0.5914026",
"0.5912253",
"0.5900922",
"0.58929133",
"0.58888423",
"0.5888426",
"0.5882698",
"0.5882015",
"0.58800685",
"0.5877362",
"0.5877305",
"0.58755714",
"0.5874652"
] | 0.0 | -1 |
POST /group_comments POST /group_comments.json | def create
@group_comment = GroupComment.new(group_comment_params)
respond_to do |format|
if @group_comment.save
format.html { redirect_to @group_comment, notice: 'Group comment was successfully created.' }
format.json { render :show, status: :created, location: @group_comment }
else
format.html { render :new }
format.json { render json: @group_comment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n if @group_comment.save\n render json: @group_comment, status: :created, location: @group_comment\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def comment\n\t\t# Get the group in question\n\t\tgroup = Group.find(params[:id])\n\n\t\t# Require an authenticated user that has joined the group\n\t\tgroup = Group.find(params[:id])\n\t\traise HTTPStatus::Unauthorized if User.current.nil? || !group.users.include?(User.current)\n\n\t\t# Create the comment\n\t\tcomment = group.create_comment(params[:comment])\n\n\t\t# save and get the proper message\n\t\tif comment.save\n\t\t\tmessage = {:type => :success, :message => \"Successfully added comment.\", :id => comment.id}\n\t\t\tself.log_analytic(:user_comment_in_group, \"User has commented in group.\", comment, [], :groups)\n\t\telse\n\t\t\tmessage = {:type => :error, :message => \"There was an error posting your comment.\"}\n\t\tend\n\n\t\t# Respond with either html or json\n\t\trespond_to do |format|\n\t\t\tformat.html { flash[message[:type]] = message[:message]; redirect_to :back }\n\t\t\tformat.json { render :json => message }\n\t\tend\n\tend",
"def group_comment_params\n params.require(:group_comment).permit(:body, :user_id, :group_id)\n end",
"def create\n @my_group_comment = GroupComment.new(params[:group_comment])\n\n @my_group_comment.group_member = GroupMember.where(:user_id => current_user.id, :group_id => @my_group_comment.group_id).first\n @group = Group.find @my_group_comment.group_id\n\n respond_to do |format|\n if @my_group_comment.save\n format.html { redirect_to([:my, @group], :notice => 'Kommentar gespeichert.') }\n format.xml { render :xml => @my_group_comment, :status => :created, :location => @my_group_comment }\n else\n format.html { redirect_to([:my, @group]) }\n format.xml { render :xml => @my_group_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n\n @course = Course.find([@group.course_id]).first\n\n @course.cfolders.each do |cfolder|\n gfolder = @group.gfolders.create(name: cfolder.name, group_id: @group.id)\n cfolder.cposts.each do |cpost|\n gpost = gfolder.gposts.create(title: cpost.id, body: cpost.body, link: cpost.link, gfolder_id: gfolder.id)\n end\n end\n\n format.html { redirect_to [@group], notice: 'group was successfully created.' }\n format.json { render :show, status: :created, location: [@group] }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @group_comments = GroupComment.all\n\n render json: @group_comments\n end",
"def create\n comment = Comment.new(comment_params)\n\n post = Post.find(params[:comment][:post_id])\n post.data[\"comments\"] = post.data[\"comments\"] + 1\n\n if comment.save && post.save\n render json: {\n status: \"success\",\n data: {\n comment: comment.as_json(include: {\n user: {\n only: [:id, :name, :avatar]\n }\n }),\n comments: post.data[\"comments\"]\n }\n }, status: :ok\n else\n render json: comment.errors, status: 404\n end\n end",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def show\n render json: @group_comment\n end",
"def create\n mygroupreplay = Hash.new\n mygroupreplay[:body] = params[:body]\n mygroupreplay[:user_id] = params[:user_id]\n mygroupreplay[:groupmessage_id] = params[:groupmessage_id]\n #render plain: params[:body]\n @groupreply = Groupreply.new(mygroupreplay)\n\n\n @groupmessage = Groupmessage.find(mygroupreplay[:groupmessage_id])\n # @user = User.find(@groupmessage.user)\n data = Hash.new\n data[:body] = \"There is a comment on your Message \" + @groupmessage.title\n data[:url] = \"/groups/\" + mygroupreplay[:groupmessage_id].to_s\n data[:notificationtype] = \"groupmessagecomment\"\n data[:user_id] = @groupmessage.user.id\n notification = Notification.create(data)\n notification.save\n\n @replayies = @groupmessage.groupreplies\n\n respond_to do |format|\n if @groupreply.save\n\n @replayies.each do |currentreplay|\n data = Hash.new\n data[:body] = \"There is a comment on your Message \" + @groupmessage.title\n data[:url] = \"/groupmessages/\" + @groupmessage.id.to_s\n data[:notificationtype] = \"groupmessagecomment\"\n data[:user_id] = currentreplay.user.id\n notification = Notification.create(data)\n notification.save\n end\n\n\n\n format.html { redirect_to @groupreply, notice: 'Groupreply was successfully created.' }\n format.json { render :show, status: :created, location: @groupreply }\n else\n format.html { render :new }\n format.json { render json: @groupreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comments_open_group_post = CommentsOpenGroupPost.new(params[:comments_open_group_post])\n\n respond_to do |format|\n if @comments_open_group_post.save\n format.html { redirect_to :back }\n format.json { render json: @comments_open_group_post, status: :created, location: @comments_open_group_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comments_open_group_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end",
"def set_group_comment\n @group_comment = GroupComment.find(params[:id])\n end",
"def create\n @radio = Radio.find(params[:radio_id])\n comment = @radio.comments.create({:body => params[:comment], :user_id => current_user.id});\n respond_to do |format|\n format.json { render :json => to_commentDTO(comment), :status => :ok }\n end\n end",
"def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end",
"def destroy\n @group_comment.destroy\n respond_to do |format|\n format.html { redirect_to group_comments_url, notice: 'Group comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n group = Group.find(params[:group_id])\n\n @subgroup = group.subgroups.create(subgroup_params)\n\n respond_to do |format|\n if @subgroup.save\n format.html { redirect_to([@subgroup.group, @subgroup], :notice => 'Comment was successfully created.') }\n format.xml { render :xml => @subgroup, :status => :created, :location => [@subgroup.group, @subgroup] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subgroup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n respond_to do |format|\n if @group_comment.update(group_comment_params)\n format.html { redirect_to @group_comment, notice: 'Group comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_comment }\n else\n format.html { render :edit }\n format.json { render json: @group_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_discussion_group\n @other_user=@login_user\n @discussion_groups = @login_user.discussion_groups\n @discussion_group = DiscussionGroup.new(:name => params[:discussion_group][:name], :user_id => @login_user.id, :description => params[:discussion_group][:description], :is_public => params[:discussion_group][:is_public])\n @notice = @discussion_group.save ? \"Group created successfully.\": activerecord_error_list(@discussion_group.errors)\n group_user = DiscussionGroupUser.create(:user_id=>@login_user.id,:discussion_group_id=>@discussion_group.id,:is_member=>true) if @discussion_group.save\n\n respond_to do |format|\n format.js\n end\n end",
"def comment options={}\n client.post(\"/#{id}/comments\", options)\n end",
"def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def reviewer_create_group\n\t\t@group = Group.new(params[:group])\n\t\[email protected]_id = nil\n\t\[email protected]\n\t\trespond_to do |form|\n\t\t\tform.js {render \"reviewer_new_group\"}\n\t\tend\n\tend",
"def index\n @group_comments = GroupComment.all\n end",
"def create\n @comment = Comment.new(params[:comment])\n @comment.user_course = curr_user_course\n commentable = @comment.commentable\n\n if commentable.respond_to?(:group_stds) and commentable.group_stds.count > 0 and curr_user_course.is_student?\n if !commentable.group_stds.include?(curr_user_course)\n return\n end\n else\n authorize! :read, commentable\n end\n\n #if @comment.save\n\n # update / create comment_topic\n comment_topic = CommentTopic.where(\n topic_id: commentable.id,\n topic_type: commentable.class).first_or_create\n comment_topic.course = @course\n comment_topic.last_commented_at = Time.now\n comment_topic.permalink = comment_topic.permalink || get_comment_permalink(commentable)\n comment_topic.pending = curr_user_course.is_student?\n comment_topic.save\n\n @comment.comment_topic = comment_topic\n @comment.save\n\n CommentSubscription.populate_subscription(@comment)\n\n respond_to do |format|\n format.json {render json: comment_topic.comments_json(curr_user_course)}\n end\n #end\n end",
"def create\n post = Post.find(params[:post_id])\n @comment = post.comments.new(comment_params)\n if @comment.save\n render json: {\n data: @comment\n }\n else\n render json: {\n errors: @comment.errors\n }\n end\n end",
"def set_group\n @group = Group.friendly.find(params[:comment][:group_id])\n end",
"def new\n @comments_open_group_post = CommentsOpenGroupPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comments_open_group_post }\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n @comment.entry_id = @entry.id # When creating a comment, need to know what entry it belongs to\n # @comment.user_id = current_user.id # need to add user id to comment - for now all comments require authentication\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect_to group_entry_path(@entry.group_id,@entry) } # was redirect_to comment_url(@entry,@comment) # was redirect_to(@comment)\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n if @group.save\n render_json_message({:success => t('.success')}, 201, {id: @group.id})\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n\n end",
"def set_comment\n @group = Group.find(params[:group_id])\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:id])\n end",
"def create\n comment = @project.comments.build(comment_params)\n\n if comment.save\n render json: comment \n else\n render json: { message: 'Error: Failed to add comment.'}\n end\n end",
"def group_message_comment_params\n params.fetch(:group_message_comment, {})\n end",
"def create\n @comment = @noticia.comments.create(comment_params)\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def create\n #if @user && @user.posts.include(@post)\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create_group\n\t\t@group = Group.new(params[:group])\n\t\[email protected]_id = params[:cardsort_id]\n\t\trespond_to do |format|\n\t\t\tif (@group.save)\n\t\t\t\tformat.js {render \"new_group\", :status => :created}\n\t\t\telse\n\t\t\t\tformat.js {render \"new_group\", :status => :ok}\n\t\t\tend\n\t\tend\n\tend",
"def destroy\n @group_comment.destroy\n\n head :no_content\n end",
"def create\n # get the post\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n # create post to comment\n @comment = @post.comments.create(body: params[:body])\n # associate comment before save(comment cannot be saved without user_id)\n @comment.user = @current_user\n # save comment\n if @comment.save\n render json: @comment, status: :ok\n else\n render json: { errors: { status: \"400\",\n title: \"Bad request\",\n details: @comment.errors\n }\n }, status: :bad_request\n end\n end",
"def create\n @contact_group = Admin::ContactGroup.new(contact_group_params)\n\n if @contact_group.save\n render json: @contact_group, status: :created\n else\n render json: @contact_group.errors, status: :unprocessable_entity\n end\n end",
"def groupreply_params\n params.require(:groupreply).permit(:body, :user_id, :groupmessage_id)\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create\n @comment = Comment.new({user_id: params[:user_id], announcement_id: params[:announcement_id], description: params[:description]})\n @comment.save\n render json:@comment\n end",
"def create\n @user = User.find(current_user.id)\n @group = Group.new(group_params)\n\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n respond_to do |format|\n if @group.save\n @user.groups << @group\n\n GroupCategory.new(group_id: @group.id , category_id: params[:category]).save\n\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = @user.comments.build(@json['comment'])\n update_values :@comment, @json['comment']\n end",
"def new_comment(name, discussion_id)\n response = self.class.post(\n @@base_uri + @@comments_uri,\n body: {\"comment\":{\"body\":name,\"discussion_id\":discussion_id,\"document_ids\":[]}}.to_json,\n headers: @headers\n )\n return response\n end",
"def create\n @blogpost = Blogpost.find(params[:blogpost_id])\n\n @comment = @blogpost.comments.create(comment_params)\n render json: @comment\n end",
"def create\n puts params.to_json\n @post = Post.find(params[:comment][:post_id])\n @comment = @post.comments.build(comment_params)\n if @comment.save\n redirect_to root_path\n end\n end",
"def create_group(path, name)\n puts \"creating #{name} on path #{path}\"\n \n ret = RestClient.post \"#{@url}/groups\", \n { path: path, name: name }, \n { \"Private-Token\": @token } \n json = JSON.parse(ret.body)\n\n json['id']\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.create(content: params[:content])\n current_user.comments << @comment\n current_user.save\n\n idea = Idea.find(params[:ideaId])\n idea.comments << @comment\n idea.comments.order(\"created_at DESC\")\n idea.save\n respond_to do |format|\n format.json {render json: @comment}\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.create_robotsurvey()\n @group.create_signupsurvey()\n @group.create_poststudysurvey()\n respond_to do |format|\n if @group.save\n \n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n if @group.save\n @group.add!(current_user)\n \n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def set_group_message_comment\n @group_message_comment = GroupMessageComment.find(params[:id])\n end",
"def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end",
"def create\n comment = Comment.new(create_params)\n comment.post = @post\n if comment.save\n render json: comment, status: 200\n else\n render json: comment.errors, status: 403\n end\n\n end",
"def create_gist_comment(gist_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"gists/#{Gist.new gist_id}/comments\", opts\n end",
"def create\n json_create_and_sanitize(comment_params, Comment)\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n format.js\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def comment_params\n params.require(:subjects).permit(:treatment_group, :comments)\n end",
"def create\n @group = Group.new(params[:group])\n\t\[email protected]_id = session[:user_id]\n\n respond_to do |format|\n if @group.save\n\n\t\t\t\t@page = Page.create(:owner => @group.id, :category => 'group')\n\t\t\t\t@group_member = GroupMember.create(:group_id => @group.id, :user_id => session[:user_id], :moderator => true)\n format.html { redirect_to groups_url, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n new_sort = Configurations.get_sort('group')\n @group.sort = new_sort\n @group.deleted = 0\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to :groups, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comment = Comment.new comment_params\n @comment.user = current_user\n if @comment.save\n @comments = Comment.where(\n polycomment_type: params[:comment][:polycomment_type],\n polycomment_id: params[:comment][:polycomment_id]\n )\n @comments = @comments.paginate(page: 1, per_page: 10)\n project = Project.find_by(name: params[:comment][:project_name])\n\n notify_followers(project, @comment)\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js {}\n end\n else\n redirect_to :back\n flash[:alert] = 'Something went wrong, try reposting your comment.'\n end\n end",
"def create\n @discussion_comment = DiscussionComment.new(discussion_comment_params)\n\n respond_to do |format|\n if @discussion_comment.save\n format.html { redirect_to @discussion_comment, notice: 'DiscussionComment was successfully created.' }\n format.json { render json: @discussion_comment }\n else\n format.html { render :new }\n format.json { render json: @discussion_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_comment\n @user = User.find(params[:user_id])\n @message = Message.find(params[:message_id])\n @comment = @message.comments.create(params.permit(:content))\n @comment.user = @user\n @comment.user_name = @user.id\n @comment.user_avatar = @user.id\n\n if @comment.save\n response = { \"code\" => 1, \"msg\" => \"Comment Created Successfully\" }\n else\n response = { \"code\" => 0, \"msg\" => \"Comment Can't be created\" }\n end\n\n render json: response\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def create\n @comment = Comment.new(params[:comment])\n @comment.save\n respond_with(@post, @comment)\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def create\n commentable = commentable_type.constantize.find(commentable_id)\n @comment = Comment.build_from(commentable, current_user.id, body)\n\n respond_to do |format|\n if @comment.save\n make_child_comment\n\n format.html { redirect_to(:back, :notice => 'Comment was successfully added.') }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_group\n if request.post?\n @user_id = params[:user_id]\n @group = params[:group_ids]\n @created_g_u= Array.new\n @group.each do |g|\n #g_user = GroupUser.find(:all,:conditions=>[\"user_id=#{@user_id.to_i} and group_id=#{g.to_i}\"])\n group_user = GroupUser.create(:user_id=>@user_id.to_i,:group_id=>g.to_i)# if g_user.blank?\n @created_g_u << group_user if group_user.id\n end\n @notice = \"Successfully added to group.\"\n respond_to do |format|\n format.js\n end\n \n else\n render :partial=>\"add_to_group_form\", :locals=>{:user=>@login_user,:user_id=>params[:id]}, :layout=>false\n end\n end",
"def create\n @comment = Comment.new(comment_params)\n @comment.user_id = @current_user.json_hash[:id]\n @comment.dinner_id = params[:id]\n if @comment.valid?\n @comment.save\n render json: @comment.comment_info\n else\n puts @comment.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @comment.errors.messages\n }\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new(customers_group_params)\n\n respond_to do |format|\n if @customers_group.save\n format.html { redirect_to @customers_group, notice: t('view.customers_groups.correctly_created') }\n format.json { render json: @customers_group, status: :created, location: @customers_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @customers_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new(customers_group_params)\n\n respond_to do |format|\n if @customers_group.save\n format.html { redirect_to @customers_group, notice: t('view.customers_groups.correctly_created') }\n format.json { render json: @customers_group, status: :created, location: @customers_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @customers_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ip = request.location\n @user = current_user\n @group = @user.groups_as_owner.new(params[:group])\n params[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n @group.school_id = @user.school_id\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @group_model.new(group_params)\n respond_to do |format|\n if @group.save\n @course.groups<< @group\n format.html { redirect_to course_group_path(@course,@group), notice: \"#{@group_model.to_s} was successfully created.\" }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n commentable = find_commentable_object\n @comment = Comment.build_from(commentable, current_user.id, params[:comment][:body], params[:comment][:title], params[:comment][:send_notification_to_root_comment] )\n \n respond_with do |format|\n if @comment.save\n @comment.moderation_setting = ModerationSetting.create(:published => true, :moderated => false, :refuse_cause => \"-\")\n @comment_created = Comment.set_comment_hash(@comment)\n @comment = Comment.new\n flash.now[:notice] = 'Comment was successfully created.'\n else\n flash.now[:alert] = 'Comment was not successfully created.'\n # @comments = @post.comment_threads\n # @tags = @post.tag_list\n # @votes_result = @post.plusminus\n # render :action => \"posts/show\"\n end\n end\n end",
"def new\n @my_group_comment = My::GroupComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_group_comment }\n end\n end",
"def create\n @comment = Comment.new(comment_params)\n respond_to do |format|\n if @comment.save\n format.json {\n render json: {status:0, msg:\"success\"} \n }\n else\n \tformat.json { \n render json: {status:-1, msg:\"failed\"} \n }\n end\n end\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Le groupe a été créé.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_discussion_topic_groups(group_id,title,message,require_initial_post,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :title,\n :message,\n :discussion_type,\n :published,\n :delayed_post_at,\n :lock_at,\n :podcast_enabled,\n :podcast_has_student_posts,\n :require_initial_post,\n :assignment,\n :is_announcement,\n :position_after,\n :group_category_id,\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"title is required\" if title.nil?\n raise \"message is required\" if message.nil?\n raise \"require_initial_post is required\" if require_initial_post.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :title => title,\n :message => message,\n :require_initial_post => require_initial_post\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics\",\n :group_id => group_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def group_params\n params.require(:group).permit(:number, :name, :color, :flr_id, :user_id, :all_stories, :mot_text, :last_update)\n end"
] | [
"0.7966938",
"0.71134216",
"0.70881176",
"0.65414613",
"0.6518584",
"0.6468242",
"0.64558345",
"0.6336049",
"0.6322477",
"0.6322477",
"0.62954056",
"0.6287795",
"0.62663126",
"0.6227368",
"0.6211254",
"0.62031484",
"0.6141405",
"0.6120739",
"0.6106294",
"0.60928917",
"0.60604084",
"0.606031",
"0.60356444",
"0.5988681",
"0.59884125",
"0.5966792",
"0.5948868",
"0.5947924",
"0.59348863",
"0.5930782",
"0.5919303",
"0.5902644",
"0.58879554",
"0.58870107",
"0.5886968",
"0.58776706",
"0.5877621",
"0.58604056",
"0.5847813",
"0.5837797",
"0.5793768",
"0.5784282",
"0.57782906",
"0.5765493",
"0.5765493",
"0.5765493",
"0.57603073",
"0.5757103",
"0.5749822",
"0.57463837",
"0.5726751",
"0.57158947",
"0.570683",
"0.5706673",
"0.56899613",
"0.56874174",
"0.56846076",
"0.5681885",
"0.56719446",
"0.5668721",
"0.5659963",
"0.56598014",
"0.56564015",
"0.5652626",
"0.5645997",
"0.56402105",
"0.56369823",
"0.5613125",
"0.56112754",
"0.5610987",
"0.5603095",
"0.55927986",
"0.55927986",
"0.55927986",
"0.55927986",
"0.55927986",
"0.5587246",
"0.55822295",
"0.5575294",
"0.5574282",
"0.55732226",
"0.55695724",
"0.55676776",
"0.55676776",
"0.5566935",
"0.55636895",
"0.55559963",
"0.5551611",
"0.5551611",
"0.5551611",
"0.5551611",
"0.5551611",
"0.5551611",
"0.5546315",
"0.5543324",
"0.5538084",
"0.55334646",
"0.55264974",
"0.5525789",
"0.5522519"
] | 0.75627595 | 1 |
PATCH/PUT /group_comments/1 PATCH/PUT /group_comments/1.json | def update
respond_to do |format|
if @group_comment.update(group_comment_params)
format.html { redirect_to @group_comment, notice: 'Group comment was successfully updated.' }
format.json { render :show, status: :ok, location: @group_comment }
else
format.html { render :edit }
format.json { render json: @group_comment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n @my_group_comment = My::GroupComment.find(params[:id])\n\n respond_to do |format|\n if @my_group_comment.update_attributes(params[:my_group_comment])\n format.html { redirect_to(@my_group_comment, :notice => 'Group comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @my_group_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comments_open_group_post = CommentsOpenGroupPost.find(params[:id])\n\n respond_to do |format|\n if @comments_open_group_post.update_attributes(params[:comments_open_group_post])\n format.html { redirect_to @comments_open_group_post, notice: 'Comments open group post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comments_open_group_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end",
"def set_group_comment\n @group_comment = GroupComment.find(params[:id])\n end",
"def update\n comment = Comment.find(params[:id])\n if comment.update(params_comment)\n render json: comment, status: 200\n else\n render json: comment.errors, status: 422\n end\n\n end",
"def update\n @comment = Comment.find(params[:id])\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.json { render :json => @comment }\n else\n format.json { render :json => @comment.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with(@post,@post.comments.update(params[:id],params[:comment]))\n end",
"def update\n\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n\n end\n\n\n end",
"def group_comment_params\n params.require(:group_comment).permit(:body, :user_id, :group_id)\n end",
"def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n if @comment.update(comment_params)\n render json: @comment, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n #if @user && @user.posts.include(@post)\n @comment.update(comment_params)\n json_response(@comment)\n end",
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @comment.update(comment_params)\n render json: @comment, serializer: CommentSerializer\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n group = Group.find(params[:group_id])\n\n @subgroup = group.subgroups.find(params[:id])\n respond_to do |format|\n if @subgroup.update(subgroup_params)\n format.html { redirect_to([@subgroup.group, @subgroup], :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subgroup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def set_comment\n @group = Group.find(params[:group_id])\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:id])\n end",
"def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end",
"def update\n @comment = Comment.find(params[:id])\n authorize @comment\n if @comment.update(comment_params)\n render 'api/v1/comments/show', status: :success\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update_comment(update_key, comment)\n path = \"/people/~/network/updates/key=#{update_key}/update-comments\"\n body = {'comment' => comment}\n post(path, MultiJson.dump(body), \"Content-Type\" => \"application/json\")\n end",
"def update_pull_request_comment(repo, comment_id, body, options = {})\n options.merge! :body => body\n patch(\"#{Repository.path repo}/pulls/comments/#{comment_id}\", options)\n end",
"def update\n @comment = Comment.find(params[:id])\n if @comment.update(comment_params)\n render json: {status: \"success\", data: {comment: @comment}}, status: :ok\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n# format.json { head :no_content }\nformat.json { render :json=>{'statusCode'=>'200','message'=>'Edit Group Success!','navTableId'=>'','rel'=>'','callbackType'=>'','forwardUrl'=>'','confirmMsg'=>''} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @comment.update_attributes(comment_params)\n render json: @comment, status: :ok\n else\n render json: {error: \"Not found\"}, status: :not_found\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_group_update.update(api_v1_group_update_params)\n format.html { redirect_to @api_v1_group_update, notice: 'Group update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n if @comment.update(comment_params)\n\n render json: @comment,status: :ok\n\n else\n\n render json: {error: true,errors: @comment.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update_gist_comment(gist_id, comment_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n patch \"gists/#{Gist.new gist_id}/comments/#{comment_id}\", opts\n end",
"def update\n respond_to do |format|\n if @groupreply.update(groupreply_params)\n format.html { redirect_to @groupreply, notice: 'Groupreply was successfully updated.' }\n format.json { render :show, status: :ok, location: @groupreply }\n else\n format.html { render :edit }\n format.json { render json: @groupreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #respond_to do |format|\n if @comment.update(comment_params)\n render json: @comment.as_json(except: [:updated_at]), status: :ok\n else\n # format.html { render :edit }\n render json: @comment.errors, status: :unprocessable_entity\n # end\n end\n end",
"def update\n if @comment.update(comment_params)\n render json: {status: 'Comment was successfully updated.'}, status: :201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def update\n @comment1 = Comment1.find(params[:id])\n\n respond_to do |format|\n if @comment1.update_attributes(params[:comment1])\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @contact_group.update(contact_group_params)\n render json: @contact_group, status: :ok\n else\n render json: @contact_group.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end",
"def update \n commentable = find_commentable_object\n @comment = Comment.find(params[:id])\n \n respond_with do |format|\n if @comment.update_attributes(params[:comment])\n @comment.pending_for_moderation\n @comment_updated = @comment\n @comment = Comment.new\n \n flash.now[:notice] = 'Comment was successfully updated.'\n else\n flash.now[:alert] = 'Comment was not successfully updated.'\n end\n end\n \n # respond_to do |format|\n # if @comment.update_attributes(params[:comment])\n # format.html { redirect_to(@post, :notice => 'Comment was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n @fbcomment = Fbcomment.find(params[:id])\n\n if @fbcomment.update(fbcomment_params) #private section#\n head :no_content\n else\n render json: @fbcomment.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group_request.update(group_request_params)\n format.html { redirect_to @group_request, notice: 'Group request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n if @group_comment.save\n render json: @group_comment, status: :created, location: @group_comment\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @comment1.update(comment1_params)\n format.html { redirect_to @comment1, notice: 'Comment1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment1 }\n else\n format.html { render :edit }\n format.json { render json: @comment1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_group_message_comment\n @group_message_comment = GroupMessageComment.find(params[:id])\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_answer_comment.update(api_v1_answer_comment_params)\n format.html { redirect_to @api_v1_answer_comment, notice: 'Answer comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer_comment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(current_user.id)\n @group = @user.groups.find(params[:id])\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n @groupcategory = GroupCategory.where(:group_id => params[:id])\n @groupcategory.update(group_id: @group.id , category_id: params[:category])\n\n respond_to do |format|\n if @group.update(title: params[:title], description: params[:description])\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to admin_comments_url, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_group.update(request_group_params)\n format.html { redirect_to @request_group, \n\t\t\t\t\t\t\t\t\t\t\tnotice: 'Request group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_group.errors, \n\t\t\t\t\t\t\t\t\t\t\tstatus: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @group\n @group.creator = current_user\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to [@section, @commentable, :comments], notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tasks_group = @tasks_group.do_before_update\n respond_to do |format|\n if @tasks_group.update(tasks_group_params)\n format.html { redirect_to @tasks_group, notice: 'Tasks group was successfully updated.' }\n format.json { render :show, status: :ok, location: @tasks_group }\n else\n format.html { render :edit }\n format.json { render json: @tasks_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end",
"def update\n @comment.update(comment_params)\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update\n\t respond_to do |format|\n\t if @comment.update(comment_params)\n\t format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n\t format.json { head :no_content }\n\t else\n\t format.html { render action: 'comment' }\n\t format.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @group_doc.update(group_doc_params)\n format.html { redirect_to @group_doc, notice: 'Group doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_doc }\n else\n format.html { render :edit }\n format.json { render json: @group_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n isadmin\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion_comment.update(discussion_comment_params)\n format.html { redirect_to @discussion_comment, notice: 'DiscussionComment was successfully updated.' }\n format.json { render json: @discussion_comment }\n else\n format.html { render :edit }\n format.json { render json: @discussion_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(params[:group])\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group.update(group_params)\n respond_with(@group)\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to \"/projects/\" + params[:comment][:project_id].to_s, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render \"/projects/\" + params[:comment][:project_id].to_s }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_discussion_group\n if request.post?\n @discussion_group = DiscussionGroup.find(params[:disc_group][:id])\n @notice = @discussion_group.update_attributes(:name => params[:discussion_group][:name], :description => params[:discussion_group][:description], :is_public => params[:discussion_group][:is_public]) ? \"Group updated successfully.\" : activerecord_error_list(@discussion_group.errors)\n #redirect_to :back\n respond_to do |format|\n format.js\n end\n else\n @discussion_group = DiscussionGroup.find(params[:id])\n render :partial => \"edit_discussion_group\"\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @issue_group = IssueGroup.find(params[:id])\n\n respond_to do |format|\n if @issue_group.update_attributes(params[:issue_group])\n format.html { redirect_to @issue_group, notice: 'Issue group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :json => {:comment => @comment, :status => 200} }\n else\n format.html { render :edit }\n format.json { render :json => {:comment => @comment, :status => 400 } }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_comment.update(admin_comment_params)\n format.html { redirect_to @admin_comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_comment }\n else\n format.html { render :edit }\n format.json { render json: @admin_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_group_field.update(api_v1_group_field_params)\n format.html { redirect_to @api_v1_group_field, notice: 'Group field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client = Client.find(params[:id])\n @client.campaign_id = session[:campaign_id]\n @groups = Group.all.map {|g| [g.name, g.id]}\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, :notice => 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @group.update(group_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @group.errors.messages}, 422)\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_back(fallback_location: root_path, notice: t('comment.update_msg')) }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json {\n render json: @comment.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to project_sprint_user_story_comments_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @collection_group.update(collection_group_params)\n format.html { redirect_to @collection_group, notice: 'Collection group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collection_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_gist_comment(comment_id, params={})\n _normalize_params_keys(params)\n _merge_mime_type(:gist_comment, params)\n _filter_params_keys(REQUIRED_GIST_COMMENT_INPUTS, params)\n\n raise ArgumentError, \"Required inputs are: :body\" unless _validate_inputs(REQUIRED_GIST_COMMENT_INPUTS, params)\n\n patch(\"/gists/comments/#{comment_id}\", params)\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @issue_path, notice: 'Comment is sucesfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit(gist_id, comment_id, params={})\n normalize! params\n assert_presence_of comment_id\n # _merge_mime_type(:gist_comment, params)\n filter! VALID_GIST_COMMENT_OPTIONS, params\n assert_required_keys(REQUIRED_GIST_COMMENT_OPTIONS, params)\n\n patch_request(\"/gists/#{gist_id}/comments/#{comment_id}\", params)\n end",
"def update\n respond_to do |format|\n if @comment.update(comment_params)\n @comment.update(post_id: params[:post_id])\n user_emails = []\n if current_user.parent_user.present?\n user_emails << current_user.parent_user.email\n current_user.parent_user.users.each {|user| user_emails << user.email }\n else\n user_emails << current_user.email\n current_user.users.each {|user| user_emails << user.email }\n end\n TestMailer.comment_email(user_emails, 'Comment edited, please check...').deliver\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @comment = Comment.find(params[:id])\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html {redirect_to contest_comments_path(:contest => @contest.permalink, :role => \"admin\", :contest_id => @contest_instance.permalink, :uuid => @contest_instance.uuid)}\n format.js { head :ok}\n else\n format.html {redirect_to contest_comments_path(:contest => @contest.permalink, :role => \"admin\", :contest_id => @contest_instance.permalink, :uuid => @contest_instance.uuid)}\n format.js { head :unprocessable_entity}\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, :notice => 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.76894987",
"0.7173845",
"0.66449296",
"0.6632936",
"0.66221356",
"0.6577847",
"0.65027326",
"0.6451958",
"0.6449836",
"0.64098847",
"0.63980967",
"0.63843966",
"0.6376269",
"0.636317",
"0.63501906",
"0.6314264",
"0.6288119",
"0.6282557",
"0.6282378",
"0.6282378",
"0.6239295",
"0.6214738",
"0.6192803",
"0.6190518",
"0.6179693",
"0.6178508",
"0.61591935",
"0.61526513",
"0.61397105",
"0.6137811",
"0.61366874",
"0.6135924",
"0.6122604",
"0.612238",
"0.6118229",
"0.6103323",
"0.60900617",
"0.6088883",
"0.60810006",
"0.60714847",
"0.6066298",
"0.60623896",
"0.6046812",
"0.6015139",
"0.6012997",
"0.6010064",
"0.6007004",
"0.6001445",
"0.59944206",
"0.5993118",
"0.59837174",
"0.59784424",
"0.59777987",
"0.59752256",
"0.59629923",
"0.5962453",
"0.5960492",
"0.5945268",
"0.5945268",
"0.5945268",
"0.5934102",
"0.5934102",
"0.59316415",
"0.59245217",
"0.5920996",
"0.5918897",
"0.5916983",
"0.5916983",
"0.5916983",
"0.5916983",
"0.59148586",
"0.5905997",
"0.59013015",
"0.5900844",
"0.5898149",
"0.58918947",
"0.58918947",
"0.58918947",
"0.58908755",
"0.5888485",
"0.5887269",
"0.5885091",
"0.588267",
"0.58773905",
"0.5874451",
"0.5873284",
"0.58707666",
"0.58703256",
"0.58688307",
"0.5863575",
"0.5861486",
"0.5861486",
"0.58604",
"0.58600634",
"0.5858221",
"0.58572626",
"0.5856461",
"0.58544517",
"0.5851412",
"0.5851412"
] | 0.7321224 | 1 |
DELETE /group_comments/1 DELETE /group_comments/1.json | def destroy
@group_comment.destroy
respond_to do |format|
format.html { redirect_to group_comments_url, notice: 'Group comment was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @group_comment.destroy\n\n head :no_content\n end",
"def destroy\n @my_group_comment = My::GroupComment.find(params[:id])\n @my_group_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_group_comments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comments_open_group_post = CommentsOpenGroupPost.find(params[:id])\n @comments_open_group_post.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_open_group_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @comment.destroy\n render json: @comment, status: :ok\n\n end",
"def delete_comments\n end",
"def destroy\n @comment.destroy\n head :no_content\n end",
"def destroy\n @comment.destroy\n head :no_content\n end",
"def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end",
"def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end",
"def destroy\n @comment.destroy!\n head :no_content\n end",
"def destroy\n @comment1 = Comment1.find(params[:id])\n @comment1.destroy\n\n respond_to do |format|\n format.html { redirect_to comment1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_request.destroy\n respond_to do |format|\n format.html { redirect_to group_requests_url }\n format.json { head :no_content }\n end\n end",
"def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end",
"def destroy\n @contact_group.destroy\n\n render json: @contact_group, status: :ok\n end",
"def destroy\n @comment = @commentable.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit_comment.destroy\n respond_to do |format|\n format.html { redirect_to visit_comments_url, notice: 'Comentario eliminado con exito' }\n format.json { head :no_content }\n end\n end",
"def delete_discussion_group\n @discussion_group = DiscussionGroup.find(params[:id])\n @discussion_group.destroy\n\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n @groupreply.destroy\n respond_to do |format|\n format.html { redirect_to groupreplies_url, notice: 'Groupreply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @comments = @photo.comments.all\n @comments.each do |cmt|\n cmt.destroy\n end\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groupaddrobj = Groupaddrobj.find(params[:id])\n @groupaddrobj.destroy\n\n respond_to do |format|\n format.html { redirect_to groupaddrobjs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n render json:@comment\n end",
"def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_doc.destroy\n respond_to do |format|\n format.html { redirect_to group_docs_url, notice: 'Group doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @content = Content.where(\"user_id = ? and group_id = ?\" , params[:user_id] , params[:id])\n\n # Delete All Comments Made Contents On User\n @content.each do |c|\n Comment.where(content_id: c.id).destroy_all()\n end\n\n # Delete All Contents Made On User\n Content.where(\"user_id = ? and group_id = ?\" , params[:user_id] , params[:id]).destroy_all\n\n # Delete All Push In User On Group\n Push.where(\"user_id = ? and pusher_id = ? and push_num = 1\" ,params[:user_id] , params[:id]).destroy_all\n\n # Delete Group\n if GroupsUser.where(:group_id => params[:id]).count() == 1\n Group.find(params[:id]).destroy\n else\n GroupsUser.where(\"user_id = ? and group_id = ?\" , params[:user_id] , params[:id]).delete_all\n end\n\n respond_to do |format|\n format.html { redirect_to home_index_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end",
"def destroy\n begin\n group = Group.find(params[:id])\n group.destroy\n render json: { \"notice\"=>\"group deleted successfully\" }\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record deleted.\" }\n end\n end",
"def destroy\n @comment1.destroy\n respond_to do |format|\n format.html { redirect_to comment1s_url, notice: 'Comment1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_comment1\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n k comment.destroy\n end\n }\n redirect_to requirements_path\n end",
"def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_group_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_updates_url, notice: 'Group update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_group.destroy\n respond_to do |format|\n format.html { redirect_to request_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to project_sprint_user_story_comments_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @imgcomment = Imgcomment.find(params[:id])\n @imgcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to imgcomments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment14.destroy\n respond_to do |format|\n format.html { redirect_to comment14s_url, notice: 'Comment14 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy_hashtaggables(@comments.pluck('id'), 'PostComment')\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Wpis został usunięty.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n @questionnaire_group.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaire_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find_by_slug_or_id(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @commentestab.destroy\n respond_to do |format|\n format.html { redirect_to commentestabs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @comment6.destroy\n respond_to do |format|\n format.html { redirect_to comment6s_url, notice: 'Comment6 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to comments_url, notice: 'Comentario eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def remove_user_from_group(user_id, group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users/#{user_id}\"\n puts \"@url is #{@url}\"\n\n @deleteResponse = HTTParty.delete(@url, :headers => $header)\n puts(\" DELETE to remove user from group has Response.code #{@deleteResponse.code} and getResponse is #{@deleteResponse}\")\nend",
"def destroy\n if @comment.nil?\n render json: {error: \"Not found\"}, status: :not_found\n else\n @comment.destroy\n render json: @comment, status: :ok\n\n end\n end",
"def destroy\n @comment = Comment.find(params[:comment_id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @casualcomment = Casualcomment.find(params[:id])\n @casualcomment.destroy\n\n respond_to do |format|\n format.html { redirect_to casualcomments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dish_comment = @dish.dish_comments.find(params[:id])\n @dish_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to dish_comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dis_group.destroy\n respond_to do |format|\n format.html { redirect_to dis_groups_url, notice: 'Dis group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def bulk_delete_comments\n comment_ids_string = params[:ids]\n comment_ids = eval(comment_ids_string)\n\n comment_ids.each do |id|\n comment = Comment.find(id.to_i)\n if !comment.nil?\n comment.destroy\n\n end\n\n end\n\n head :no_content\n\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @comment_node = CommentNode.find(params[:id])\n @comment_node.destroy\n\n respond_to do |format|\n format.html { redirect_to comment_nodes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @comment = @posting.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n #@comment.create_activity :destroy, owner: current_user\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @commentable.comments.find(params[:id]).destroy\n render json: { success: true }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fbcomment.destroy\n\n head :no_content\n end",
"def destroy\n @section_comment = SectionComment.find(params[:id])\n @section_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to section_comments_url }\n format.json { head :ok }\n end\n end",
"def delete(group)\n url = build_url(group)\n response = rest_delete(url)\n response.return!\n end",
"def destroy\n @group_client.destroy\n respond_to do |format|\n format.html { redirect_to group_clients_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.77216685",
"0.75853777",
"0.7110435",
"0.6995834",
"0.6971399",
"0.68888915",
"0.6877323",
"0.6877323",
"0.6854101",
"0.68328667",
"0.68066293",
"0.67974323",
"0.6779638",
"0.6766686",
"0.6745163",
"0.67264277",
"0.6723388",
"0.66722554",
"0.66646594",
"0.664582",
"0.66454047",
"0.6644902",
"0.6639772",
"0.6637435",
"0.6624108",
"0.6617807",
"0.66176367",
"0.66090095",
"0.6604749",
"0.660154",
"0.659437",
"0.6590884",
"0.6581205",
"0.6580048",
"0.6577049",
"0.6577049",
"0.6577049",
"0.6576414",
"0.6574248",
"0.65641636",
"0.6560474",
"0.65554893",
"0.65552545",
"0.65507257",
"0.6536629",
"0.6536629",
"0.6536629",
"0.6536629",
"0.6536629",
"0.6536629",
"0.65308505",
"0.6527885",
"0.65266275",
"0.6526601",
"0.6526304",
"0.6525298",
"0.6525298",
"0.6525298",
"0.6524402",
"0.6524402",
"0.6524201",
"0.6524201",
"0.65178627",
"0.6516296",
"0.6516296",
"0.6516296",
"0.6516296",
"0.6516296",
"0.65128744",
"0.65116036",
"0.65020853",
"0.6498661",
"0.64971966",
"0.6488229",
"0.64799494",
"0.647906",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478902",
"0.6478529",
"0.64782804",
"0.64773506",
"0.64757454",
"0.6468468",
"0.64625674",
"0.6459818",
"0.64587307",
"0.64585596"
] | 0.7408694 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_group_comment
@group_comment = GroupComment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def _handle_action_missing(*args); end"
] | [
"0.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865",
"0.53135896",
"0.52999926",
"0.5297309",
"0.5296569",
"0.5261449",
"0.5247048",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52376497",
"0.52323204",
"0.52310973",
"0.523081",
"0.5225785",
"0.5219039",
"0.52136266",
"0.5208033",
"0.520763",
"0.5177365",
"0.5175224",
"0.5173357",
"0.5166104",
"0.5162502",
"0.51573396",
"0.5154547",
"0.5153531",
"0.51502854",
"0.51436496",
"0.5142863",
"0.51330835",
"0.5115634",
"0.5115634",
"0.511527",
"0.5109693",
"0.51076853",
"0.5093146",
"0.5090683",
"0.50829846",
"0.50819314",
"0.50670373",
"0.5055505",
"0.5053398",
"0.50504035",
"0.50504035",
"0.5037765",
"0.5027292",
"0.5024484",
"0.50150335",
"0.5014069",
"0.50022113",
"0.5001542",
"0.49981874",
"0.49915564",
"0.49915564",
"0.49880967",
"0.4982312",
"0.49787375",
"0.49786067",
"0.49687737",
"0.49676532",
"0.49602765",
"0.49565676",
"0.49550772",
"0.495342",
"0.49522525",
"0.49463704",
"0.49447197",
"0.49362713",
"0.49328062",
"0.49280638",
"0.49272856",
"0.4927058",
"0.49221697",
"0.4919526",
"0.49185994",
"0.49184805",
"0.49170163",
"0.49168405",
"0.49167764"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def group_comment_params
params.require(:group_comment).permit(:body, :user_id, :group_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
event firing when document processing(transformation) is done | def doc_transformed(root)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process!(document); end",
"def on_end_document\n end",
"def after_processing\n end",
"def post_process; end",
"def after_processing_hook; end",
"def post_process(doc)\n doc\n end",
"def post_process\n end",
"def on_end_document\n STDOUT << \"on_end_document\\n\"\n STDOUT.flush\n end",
"def on_start_document\n end",
"def on_start_document() end",
"def process_pdf\n\t\tif before_generate_pdf.blank?\n\t\t\tself.ready_for_pdf_generation = nil\n\t\telse\n\t\t\tself.ready_for_pdf_generation = Time.now.to_i \n\t\tend\n\tend",
"def run_and_transform; end",
"def on_start_document\n STDOUT << \"on_start_document\\n\"\n STDOUT.flush\n end",
"def notify_end_document\n @state = :end_document\n notify(:end_document)\n end",
"def completed_text_extraction\n end",
"def process\n save_as(:processed)\n end",
"def on_doc_loaded\r\n\t\t@graph = @doc.at('Graph')\r\n\t\t@scene = @graph.at('Scene')\r\n\t\t@logic = @doc.at('Logic')\r\n\r\n\t\tgenerate_custom_classes\r\n\t\trebuild_caches_from_document\r\n\r\n\t\tnil\r\n\tend",
"def end_document; end",
"def end_document; end",
"def process\n convert\n render\n write\n end",
"def on_end_document()\n\n\t\tif ['PostgreSQL','MySQL'].include?(@source.connection.adapter_name) then\n\t\t\tresolve_ids_sql\n\t\t\t#resolve_ids_activerecord\n\t\telse\n\t\t\tresolve_ids_activerecord\n\t\tend\n\t\t\n\t\tputs UnresolvedId.count(:conditions => {:source_id => @source.id}).to_s + \" unresolved IDs\" if Debug > 3\n\n\t\t# add state_id to streets. this eases later lookup\n\t\t# We use a shortcut when we can, rails convention if we're not sure\n\t\tif ['PostgreSQL','MySQL'].include?(@source.connection.adapter_name) then\n\t\t\tadd_state_to_addresses_sql\n\t\telse\n\t\t\tadd_state_to_addresses_activerecord\n\t\tend\n\n\t\[email protected]_completed_at = Time.now\n\t\[email protected] = @contrib unless @contrib.nil?\n\t\[email protected]!\n\t\[email protected]\n\n\tend",
"def processed!\n self.update_attribute :processed, true\n end",
"def apply_custom_transformation\n end",
"def ev_do_postprocess(was_events); end",
"def render_document; end",
"def transform(transformation)\n end",
"def basic_transform (filenameIn,filenameOut)\r\n @inputFilename = filenameIn\r\n @outputFilename = filenameOut\r\n self.with_document_do(filenameIn) { |doc| \r\n File.open(filenameOut,'w'){ |target| \r\n @output = target\r\n self.apply doc\r\n }\r\n }\r\n end",
"def perform_transformation(msg)\n self.send(@transformation_block, msg)\n end",
"def on_transform(&blk)\n @transform_handler = blk\n self\n end",
"def on_begin_process()\n # subclasses may override this method \n end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def start_document; end",
"def start_document; end",
"def process(event)\n event_data = build_event_data(event)\n transform_and_write(event, event_data)\n end",
"def transformation\n end",
"def transform\n end",
"def apply!(document)\n @processors.each do |pn|\n prc = Mdoc.get_processor(pn)\n prc.new.pre_processors.each { |p| document.apply!(p) }\n document.apply!(prc)\n prc.new.post_processors.each { |p| document.apply!(p) }\n end\n\n writer.new.process!(document)\n end",
"def on_end_process()\n # subclasses may override this method\n end",
"def transformations; end",
"def process\n raise \"Must be implemented\"\n end",
"def process\n self.reset\n self.read_layouts\n\n self.zones = self.read_zones\n # pp self.zones\n\n self.transform_pages\n end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process\n begin\n @pdf = document.slug + '.pdf'\n pdf_contents = asset_store.read_pdf document\n File.open(@pdf, 'wb') {|f| f.write(pdf_contents) }\n case input['task']\n when 'text' then process_text\n when 'images' then process_images\n end\n rescue Exception => e\n LifecycleMailer.exception_notification(e,options).deliver_now\n raise e\n end\n document.id\n end",
"def transforms; end",
"def after_source_extraction(extracted_source)\n end",
"def pre_process\n end",
"def process\n end",
"def rebuild_document_collection()\n end",
"def completed_text_extraction\n @found_completed_text_extraction = true\n end",
"def transform; end",
"def process_pdf\n puts \"In #process_pdf\"\n # TODO refactor this so we're not passing so many arguments to the method\n respond \"```\\nAttempting PDF compilation. Reticulating splines etc...\\n```\"\n WhedonWorker.perform_async(@config.papers, @config.site_host, @config.site_name, @nwo, @issue_id)\nend",
"def after_generate_callbacks; end",
"def postprocess(document)\n document.gsub(\"\\n\", ' ').strip\n end",
"def finish_preparations\n munge\n @document.attributes['alternative_language_counter'] = @counter + 1\n @listing_text = @listing.convert\n @colist_text = @colist&.convert\n end",
"def process\n document.add_opinions_layer\n opinions.each.with_index do |opinion, index|\n document.add_opinion opinion, index+1\n end\n\n document.add_linguistic_processor\n\n if document.pretty then pretty_print document else document.to_xml end\n end",
"def StartTransform\n\t\tout('q');\n\tend",
"def before_processing\n end",
"def postprocess(full_document)\n full_document.gsub(/^-(\\*+)/m, '\\1')\n\tend",
"def processing!\n self.sub_state = :processing\n save!\n end",
"def finish_up\n self.document.root = self\n end",
"def after_generate_pdf\n\t\tsend_notifications\n\tend",
"def after_generate_pdf\n\t\tsend_notifications\n\tend",
"def process\n self.generate\n end",
"def postprocess(html_document)\n # if more transforms are added here, some sort of proper pipeline\n # should be considered\n doc = Nokogiri::HTML::DocumentFragment.parse(html_document)\n doc = make_img_src_urls_protocol_relative(doc)\n remove_comments(doc.to_s)\n end",
"def post_process(pages)\n end",
"def finished; end",
"def process_result\n end",
"def pdf_processing(json_information_message)\n puts \"Handling pdf processing for \"\n puts json_information_message['email']\n sleep 5.0\n puts \"pdf processing done\"\n end",
"def process!\n end",
"def create\n @document = Document.new(document_params)\n case @document.doc_type\n when 'registration_certificate'\n case @document.language\n when \"English\"\n @translation = EnglishRegistrationCertificate.new()\n @translation.document = @document\n\n #here comes preProcessing and OCR things\n end\n else\n #here should be redirection to document#new\n end\n\n respond_to do |format|\n if @document.save\n params[:document_images]['image'].each do |i|\n @document_image = @document.document_images.create!(:image => i)\n @imageUrl = @document_image.image.current_path\n @imageDimensions = FastImage.size(@imageUrl) #=> [x,y]\n\n #working stuff\n response = Ocr.processDocument(@document.doc_type, @document.language, @document.document_images.load)\n @xmlTranslation = Nokogiri::XML(response)\n\n #\n # Temporary\n #\n @translation.registrationNumber = '1234567'\n @translation.circle = 'ABC 123 kółko'\n @translation.registeredKeeper = \"Andrzej Strzelba\"\n @translation.referenceNumber = \"1234 5678 90\"\n @translation.previousRegisteredKeeper = \"Bartek Walaszek, BFF\"\n @translation.dateOfPurchase = \"20.11.2014\"\n @translation.numberOfPreviousOwners = \"3\"\n @translation.specialNotes = \"Niemiec płakał jak sprzedawał. Niemiec odwoził do granicy!\"\n\n #\n # Here comes the XML parser\n #\n @translation.parseResponse(response)\n\n #\n # BTW. translation variable 4 document is sensless - we have to remove it as soon as possible :: when parsed response will be saved in database (EnglishRegistrationCetificate)\n #\n @document.translation = @xmlTranslation.css(\"value\").text\n\n #\n # @document variables should be set before savin' !!\n #\n\n @document.save\n end\n\n if @translation.save\n\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n @document.destroy\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def after_update\n super\n self.class.call_es { _index_document }\n end",
"def process\n unless File.exists?(@translation_file)\n raise Mongify::Mongoid::TranslationFileNotFound, \"Unable to find Translation File at #{@translation_file}\"\n end\n\n generate_models\n process_fields\n generate_embedded_relations\n write_models_to_file\n nil\n end",
"def transform\n # Pass through\n @target.transform\n end",
"def processed_source=(_); end",
"def processed_source=(_); end",
"def process\n self.read_layouts\n self.transform_pages\n if options['also_copy']\n self.transform_pages('', options['also_copy'])\n end\n self.write_posts\n end",
"def regenerate_pdf(sender)\n write_to_ly_file\n run_lilypond_task(sender)\n reload_pdf\n end",
"def processor; end",
"def end_document\n # postprocess @text to remove trailing spaces on lines\n @text = @text.split(\"\\n\").map(&:strip).join(\"\\n\")\n # remove trailing whitespace at end of buffer\n @text.strip!\n end",
"def after_process(ant)\n end",
"def finish(path, document, node)\n end",
"def process\n self.read_layouts\n self.transform_pages\n self.write_posts\n end",
"def after_destroy\n super\n self.class.call_es { _destroy_document }\n end"
] | [
"0.7037438",
"0.6864252",
"0.67200506",
"0.6669725",
"0.66413105",
"0.660063",
"0.6589206",
"0.62968963",
"0.62178844",
"0.6135454",
"0.60652685",
"0.6048961",
"0.603383",
"0.59540254",
"0.5935851",
"0.5907491",
"0.5879274",
"0.58672494",
"0.58672494",
"0.58188516",
"0.5818016",
"0.5801832",
"0.578926",
"0.57806075",
"0.57552224",
"0.57381403",
"0.569611",
"0.5678307",
"0.5671859",
"0.5670023",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.5645884",
"0.56269026",
"0.56269026",
"0.5612423",
"0.5608592",
"0.5604326",
"0.5568031",
"0.5566832",
"0.55657434",
"0.55628407",
"0.5537264",
"0.5534128",
"0.5534128",
"0.5534128",
"0.5534128",
"0.5534128",
"0.5534128",
"0.5534128",
"0.5534128",
"0.5533881",
"0.5528587",
"0.55262065",
"0.5522169",
"0.5520161",
"0.55110294",
"0.54915595",
"0.5489125",
"0.5488118",
"0.5486974",
"0.5485066",
"0.5468932",
"0.54688126",
"0.54522365",
"0.5436326",
"0.54072326",
"0.53849995",
"0.53681356",
"0.5366467",
"0.5366467",
"0.53643733",
"0.53548306",
"0.5328637",
"0.532667",
"0.5323406",
"0.5317542",
"0.53103805",
"0.5293425",
"0.52920854",
"0.52733266",
"0.5273284",
"0.5269342",
"0.5269342",
"0.5258238",
"0.52575916",
"0.525196",
"0.52423644",
"0.5238506",
"0.523416",
"0.5223848",
"0.521969"
] | 0.5643243 | 41 |
Builds the enum from string | def build_from_hash(value)
constantValues = AnnotationType.constants.select { |c| AnnotationType::const_get(c) == value }
raise "Invalid ENUM value #{value} for class #AnnotationType" if constantValues.empty?
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = NewOrResale.constants.select { |c| NewOrResale::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NewOrResale\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CageType.constants.select { |c| CageType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CageType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = GSuiteBuiltinTranslation.constants.select{|c| GSuiteBuiltinTranslation::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #GSuiteBuiltinTranslation\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = Chain.constants.select { |c| Chain::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Chain\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = OrderStatus.constants.select { |c| OrderStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OrderStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = FrontendState.constants.select { |c| FrontendState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FrontendState\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExternalOrderItemSourceTypeEnumModel\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = Channel.constants.select { |c| Channel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Channel\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = RequestType.constants.select { |c| RequestType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RequestType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = TransactionState.constants.select { |c| TransactionState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionState\" if constantValues.empty? && !value.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = OperationStatus.constants.select { |c| OperationStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CorporateType.constants.select { |c| CorporateType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorporateType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ChargeType.constants.select { |c| ChargeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ChargeType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = PaymentAccountSchemeName.constants.select { |c| PaymentAccountSchemeName::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PaymentAccountSchemeName\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CorrectCodeType.constants.select { |c| CorrectCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CorrectCodeType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = TransactionType.constants.select { |c| TransactionType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = MessageStatus.constants.select { |c| MessageStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #MessageStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ContentEncoding.constants.select { |c| ContentEncoding::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentEncoding\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end",
"def build_from_hash(value)\n constantValues = TransactionTypeEnumModel.constants.select { |c| TransactionTypeEnumModel::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TransactionTypeEnumModel\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CurrencyCode\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ColorType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = DaemonState.constants.select { |c| DaemonState::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DaemonState\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = BarcodeType.constants.select { |c| BarcodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BarcodeType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = BillingCondition.constants.select { |c| BillingCondition::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BillingCondition\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = FeatureFlagChangeRequestReviewStatus.constants.select { |c| FeatureFlagChangeRequestReviewStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #FeatureFlagChangeRequestReviewStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ErrorCodeOmnichannelMachine.constants.select { |c| ErrorCodeOmnichannelMachine::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ErrorCodeOmnichannelMachine\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ContactType.constants.select { |c| ContactType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContactType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = LedColor.constants.select { |c| LedColor::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LedColor\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = BrokerAccountType.constants.select { |c| BrokerAccountType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BrokerAccountType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ObjectType.constants.select { |c| ObjectType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ObjectType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CountryExtended.constants.select { |c| CountryExtended::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CountryExtended\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = Condition.constants.select { |c| Condition::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Condition\" if constantValues.empty?\n value\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n State.send(:new, 'UNKNOWN', value)\n end",
"def build_from_hash(value)\n constantValues = ResponseErrorCode.constants.select { |c| ResponseErrorCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ResponseErrorCode\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = WorkUnitStatus.constants.select { |c| WorkUnitStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #WorkUnitStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = LeaveCategoryCode.constants.select { |c| LeaveCategoryCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LeaveCategoryCode\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = DocumentFormat.constants.select { |c| DocumentFormat::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #DocumentFormat\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ContentModuleType.constants.select { |c| ContentModuleType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ContentModuleType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = OperationTypeWithCommission.constants.select { |c| OperationTypeWithCommission::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OperationTypeWithCommission\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CriteriaOperator.constants.select { |c| CriteriaOperator::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CriteriaOperator\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ShipmentLineStatus.constants.select { |c| ShipmentLineStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ShipmentLineStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ConnectionStatus.constants.select { |c| ConnectionStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ConnectionStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = UnitOfLength.constants.select { |c| UnitOfLength::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #UnitOfLength\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ProcessCodeType.constants.select { |c| ProcessCodeType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ProcessCodeType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ReferenceTypeId.constants.select { |c| ReferenceTypeId::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReferenceTypeId\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ReturnReason.constants.select { |c| ReturnReason::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReturnReason\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = TaxMode.constants.select { |c| TaxMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #TaxMode\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constValues = ErrorCode.constants.select{|c| ErrorCode.const_get(c).value == value}\n raise \"Invalid ENUM value #{value} for class #ErrorCode\" if constValues.length != 1\n @value = ErrorCode.const_get(constValues[0]).value\n self\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def build_from_hash(value)\n constantValues = Coin.constants.select{|c| Coin::const_get(c) == value}\n raise \"Invalid ENUM value #{value} for class #Coin\" if constantValues.empty?\n value\n end",
"def from_string(string)\n from_bits(*Builder::FromString.new(string).bits)\n end",
"def build\n if @symbols.empty?\n raise ArgumentError, \"trying to create an empty enum\"\n end\n\n # Create the values, if they are not provided\n current_value = 0\n symbols.each do |sym_def|\n sym_def[1] ||= current_value\n current_value = sym_def[1] + 1\n end\n registry.do_create_enum(name, symbols, size)\n end",
"def build_from_hash(value)\n constantValues = AddressValidationDetailCode.constants.select { |c| AddressValidationDetailCode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AddressValidationDetailCode\" if constantValues.empty?\n value\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def build_from_hash(value)\n constantValues = OptionalFulfillmentProgram.constants.select { |c| OptionalFulfillmentProgram::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #OptionalFulfillmentProgram\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CardFunction.constants.select { |c| CardFunction::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CardFunction\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #BroadcastResolution\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = SchemaFieldMode.constants.select { |c| SchemaFieldMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SchemaFieldMode\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = LiveDimensions.constants.select { |c| LiveDimensions::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #LiveDimensions\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = PassportPDFStatus.constants.select { |c| PassportPDFStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PassportPDFStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = CategoryTaxonomy.constants.select { |c| CategoryTaxonomy::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #CategoryTaxonomy\" if constantValues.empty?\n value\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n ReturnStatus.send(:new, 'UNKNOWN', value)\n end",
"def build_from_hash(value)\n constantValues = AnonymousCartSignInMode.constants.select { |c| AnonymousCartSignInMode::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #AnonymousCartSignInMode\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = ReturnItemDisposition.constants.select { |c| ReturnItemDisposition::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ReturnItemDisposition\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = PayoutMethodNatureOfBusinessEnum.constants.select { |c| PayoutMethodNatureOfBusinessEnum::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PayoutMethodNatureOfBusinessEnum\" if constantValues.empty? && !value.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = Where.constants.select { |c| Where::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #Where\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = EnergyEfficiency.constants.select { |c| EnergyEfficiency::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #EnergyEfficiency\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = WallType.constants.select { |c| WallType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #WallType\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = NotificationDescription.constants.select { |c| NotificationDescription::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #NotificationDescription\" if constantValues.empty?\n value\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n TransferStatus.send(:new, 'UNKNOWN', value)\n end",
"def build_from_hash(value)\n constantValues = RegistrationSuccess.constants.select { |c| RegistrationSuccess::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #RegistrationSuccess\" if constantValues.empty?\n value\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n UserAccountStatus.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n MessageStatus.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n TestStatus.send(:new, 'UNKNOWN', value)\n end",
"def build_from_hash(value)\n constantValues = ImageFilters.constants.select { |c| ImageFilters::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ImageFilters\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = SignatureHash.constants.select { |c| SignatureHash::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #SignatureHash\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = PrivacySetting.constants.select { |c| PrivacySetting::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PrivacySetting\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = PayoutMethodTransferReasonEnum.constants.select { |c| PayoutMethodTransferReasonEnum::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PayoutMethodTransferReasonEnum\" if constantValues.empty? && !value.empty?\n value\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end"
] | [
"0.66046983",
"0.6548398",
"0.65373033",
"0.6528928",
"0.64598405",
"0.6446511",
"0.64443517",
"0.6443306",
"0.6406087",
"0.6405894",
"0.6379518",
"0.6374375",
"0.6367104",
"0.6359485",
"0.6346857",
"0.63404876",
"0.6319777",
"0.63088304",
"0.6306753",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.63046414",
"0.6300229",
"0.6293263",
"0.6285593",
"0.6282434",
"0.62693965",
"0.624315",
"0.62353456",
"0.6216405",
"0.62126017",
"0.6211281",
"0.6211143",
"0.62068415",
"0.61960834",
"0.61944777",
"0.61647266",
"0.6156157",
"0.6156157",
"0.6147142",
"0.6144937",
"0.6121632",
"0.6118276",
"0.6112472",
"0.6107167",
"0.61034465",
"0.6091764",
"0.60854405",
"0.60830003",
"0.6061139",
"0.6058773",
"0.6058027",
"0.60466254",
"0.6044986",
"0.60386795",
"0.60386795",
"0.6037201",
"0.60323167",
"0.6029576",
"0.60224247",
"0.6014974",
"0.5993464",
"0.5991553",
"0.597526",
"0.59543365",
"0.59538156",
"0.5947722",
"0.5937007",
"0.58930445",
"0.58826417",
"0.58750665",
"0.58574015",
"0.5856747",
"0.5840518",
"0.584032",
"0.5837485",
"0.58354276",
"0.5833781",
"0.5804664",
"0.57942545",
"0.57942545",
"0.57782817",
"0.57782817",
"0.5762617",
"0.57621837",
"0.57552505",
"0.5750079",
"0.57462454",
"0.57462454",
"0.57462454",
"0.57462454",
"0.57462454"
] | 0.63550735 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.