query
stringlengths
7
9.5k
document
stringlengths
10
1.07M
negatives
listlengths
19
19
metadata
dict
Below code is used in show and edit_task to get lawyer details.
def lawyer_details(notes) @allowed_ids=[] lawyer = Employee.find_by_user_id(notes.assigned_by_employee_user_id, :include => [:company => :employees]) lawyer.company.employees.each do |employee| @allowed_ids << employee.user_id end end
[ "def get_lawyer_info(matter)\n @lawyer = User.find(matter.employee_user_id)\n end", "def find_lawyer\n @lawyer = Lawyer.find(params[:id])\n end", "def show_lawyer_list\n authorize!(:show_lawyer_list,current_user) unless current_user.role?:secretary\n #session[:verified_secretary_id1] = params[:service_provider_id]\n if params[:search].nil?\n @employees = Employee.paginate :page => params[:page], :order => 'employees.created_at DESC', :per_page=>20, :include=>[:user=>[:role,:service_provider_employee_mappings]]\n else\n @employees = Employee.get_employees(params)\n end\n end", "def get_lawyer_name\n if self.employee_user_id\n if self.user\n self.user.try(:full_name).try(:titleize)\n end\n else\n ''\n end\n end", "def ledger\n # FIXME check if the current user is allowed to access this ledger\n @self_id = params[:id].to_i\n @summaries = <%= name_details[:ledger_item][:class_name_full] %>.account_summaries(@self_id)\n @names = <%= name_details[:ledger_item][:class_name_full] %>.sender_recipient_name_map(@self_id, @summaries.keys)\nend", "def display_personal_info_and_disclaimer\n display_personal_information()\n display_disclaimer()\n end", "def author\n Person.find(self.issuer_id).full_name\n end", "def index\n @dealerpersonalinfos = current_dealer().dealerpersonalinfo\n end", "def lead_lawyer\n MatterPeople.first(:conditions =>\n [\"employee_user_id = ? AND matter_id = ? AND is_active = ?\", self.employee_user_id, self.id, true])\n end", "def detail\n @user = fetch_user\n @pay_period = PayPeriod.find_by(id: params[:pay_period_id])\n details = fetch_earning_details(@user, @pay_period) if @pay_period\n query = apply_list_query_options(details)\n @earning_details = query\n end", "def get_enrollments_details_of_current_user(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/enrollments/myenrollments/#{org_unit_id}/\"\n _get(path)\n # Returns: MyOrgUnitInfo JSON block.\nend", "def show_accounting_for_loan\n @accounting_book = @loan.accounting_book\n @accounting_entries = @accounting_book.accounting_entries\n\n authorize Loan\n end", "def is_lead_lawyer?(matter)\n get_employee_user_id == matter.employee_user_id \n end", "def get_assigend_lawyers_of_company\n @lawyer_users = get_company_lawyers(current_user,params[:company_id], params[:model_name])\n render :update do |page|\n page.replace_html 'lawyer_filter_option', :partial=>'wfm/shared/lawyer_filter_select'\n end\n end", "def contributor_details\n logger.debug(\"Role contributor_details\")\n @role = Role.find(params[:id])\n #@role.updated_by= get_user.login_id\n \n @person = @role.person\n @organisation = @role.organisation\n #if !@person.is_contributor?\n # flash[:notice] = 'Please make this person a contributor before editing contributor information'\n # redirect_to :action => 'edit', :id => @person\n # return\n #end\n setup_contributor\n end", "def index\n @lawyer_profiles = LawyerProfile.all\n end", "def seller\n author\n end", "def referred_by\n expose Account.referred_by(@oauth_token, params[:membername], params[:referral_id_or_membername])\n end", "def seller_name\n seller.profile.full_name\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Searches enquiries based on agents or agencies.
def enquiries_search(opts = {}) data, _status_code, _headers = enquiries_search_with_http_info(opts) data end
[ "def enquiries_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'\n end\n # resource path\n local_var_path = '/v1/enquiries'\n\n # query parameters\n query_params = {}\n query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil?\n query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EnquiriesApi#enquiries_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end", "def agencies_search(q, opts = {})\n data, _status_code, _headers = agencies_search_with_http_info(q, opts)\n data\n end", "def officers(q, items_per_page = nil, start_index = nil)\n params = {q: q,\n items_per_page: items_per_page,\n start_index: start_index}\n client.get(\"search/officers\", params)\n end", "def search(params)\n\n search_text = params[:'search-text'] || \"web developer\"\n search_location = params[:'search-location'] || \"Boston, MA\"\n start_date = params[:'start-date'] || Date.today\n\n start_date = Date.strptime(start_date) if start_date.is_a?(String)\n\n search_form = get_search_form\n\n search_form.q = search_text\n search_form.l = search_location\n\n response = @agent.submit(search_form)\n\n #job_list = scrape_jobs( sort_by_date( response ) ) # see below\n job_list = scrape_jobs( response )\n\n results = []\n\n job_list.each_entry do |job|\n results << scrape_details(job, start_date)\n end\n\n results\n\n end", "def search_for_applications(to_date = Date.today, from_date = to_date - 14, agent = get_user_agent)\n # Tell the user what we're doing\n log \"Searching for applications between #{from_date} and #{to_date}\"\n\n # Get the search page and submit the search\n search_page = agent.get(\"http://planning.northamptonboroughcouncil.com/Planning/lg/GFPlanningSearch.page?org.apache.shale.dialog.DIALOG_NAME=gfplanningsearch&Param=lg.Planning\")\n search_form = search_page.form_with(:id => \"_id122\")\n search_form[\"_id122:SDate1From\"] = from_date.strftime(\"%d/%m/%Y\")\n search_form[\"_id122:SDate1To\"] = to_date.strftime(\"%d/%m/%Y\")\n search_button = search_form.button_with(:id => \"_id122:_id180\")\n search_results = agent.submit(search_form, search_button)\n \n # Process the results - will recursively fetch additional pages\n process_search_results(agent, to_date, from_date, search_results)\nend", "def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @q = Merchant::AcquirerOrg.search(params[:q])\n @merchant_acquirer_orgs = @q.result.order(created_at: :desc).paginate(page: @page, per_page: @limit)\n end", "def search_for_companies\n populate_company_data\n company_search\n end", "def search_inspections\n search_business_context( true )\n end", "def search\n query = search_params.select{|k,_| PERMITTED_KEYS.include? k}\n if query['result_types'].present?\n query['result_types'].select!{|k| RESULT_TYPES.include? k}\n else\n query['result_types'] = ['claim'] # claim is default search type\n end\n\n @submission_results, @claim_results = nil, nil\n if query['result_types'].include?('submission')\n submission_query = query.select{|k,_| SUBMISSION_QUERY_KEYS.include? k}\n @submission_results = Submission.where(submission_query)\n end\n\n if query['result_types'].include?('claim')\n claim_query = query.select{|k,_| CLAIM_QUERY_KEYS.include? k}\n @claim_results = Claim.where(claim_query)\n if query['from'] && query['to']\n @claim_results = @claim_results.joins(:services).where(services: {date: query['from']..query['to']})\n elsif query['from']\n @claim_results = @claim_results.joins(:services).where('services.date > ?', query['from'])\n elsif query['to']\n @claim_results = @claim_results.joins(:services).where('services.date < ?', query['to'])\n end\n @claim_results = @claim_results.uniq\n end\n end", "def enable_search_on(*attributes)\n self.instance_eval do\n get SEARCH_ROUTE do\n retrieve_resources '' do |resource|\n\n pass if !involved? || params[:q].blank? || params[:q].size > 100\n\n terms = params[:q].split(/[\\+ ]/)\n search_terms = []\n\n # Seperate terms to match\n terms.each do |term|\n attributes.each do |attr|\n search_terms << resource.arel_table[attr.to_sym].matches(\"%#{term}%\")\n end\n end\n\n resource.where(search_terms.reduce(:or)).limit(100).\n flatten.as_json(read_scope)\n end\n end\n end\n end", "def search_for_active_organizations(**args)\n search_for_organizations(historic: false, **args)\n end", "def enquiries\n #cache_response(params[:udprn].to_i, [params[:page], params[:buyer_id], params[:qualifying_stage], params[:rating], params[:archived], params[:closed], params[:count]]) do\n page = params[:page]\n page ||= 0\n page = page.to_i\n udprn = params[:udprn].to_i\n count = params[:count].to_s == 'true'\n is_premium = @current_user.is_premium rescue false\n old_stats_flag = (params[:old_stats_flag].to_s == 'true')\n profile = @current_user.class.to_s\n event_service = EventService.new(udprn: udprn, buyer_id: params[:buyer_id], \n last_time: params[:latest_time], qualifying_stage: params[:qualifying_stage],\n rating: params[:rating], archived: params[:archived], is_premium: is_premium, \n closed: params[:closed], count: count, profile: profile, old_stats_flag: old_stats_flag)\n if @current_user.is_a?(Agents::Branches::AssignedAgent) && event_service.details[:agent_id].to_i != @current_user.id\n render json: { message: 'The agent does not belong to the property' }, status: 400\n else\n enquiries = event_service.property_specific_enquiry_details(page)\n render json: enquiries, status: 200\n end\n #end\n end", "def find_jobs_by_term\n\n print \"\\nEnter a search term to filter jobs by: \".blue\n search_term = gets.strip\n\n jobs = FreelancerFinder::Job.all.find_all do |job|\n job.title.include?(\"#{search_term}\") || job.short_description.include?(\"#{search_term}\") || !!job.tags.detect {|tag| tag.include?(\"#{search_term}\")}\n end\n\n jobs\n end", "def search(keywords, *fields)\n return all\n end", "def search_expenses\n if tag_ids\n @expenses = Expenses::Query.index_includes Expense.any_tags(*tag_ids)\n else\n @expenses = Expenses::Query.new.index(params).order('date desc, accounts.id desc')\n end\n\n set_expenses_filters\n @expenses = @expenses.page(@page)\n end", "def oai_registry_search(registry_name, xml_interface)\n results = Array.new\n\n # If OAI Regsitry is disabled in global config, just return no results\n return results if !$oai_registry\n\n puts \"---------------------\"\n puts \"Querying #{registry_name} OAI-PMH registry for likely DSpace sites ...\"\n puts \"(using XML interface at: #{xml_interface})\"\n\n # Request the full registry in XML & check return status\n open_page = open(xml_interface)\n puts \" Status returned: #{open_page.status.join(' ')}\"\n\n # Parse the response as XML\n doc = Nokogiri::XML(open_page)\n # Remove namespaces from result, as Nokogiri gets confused by their XML namespaces\n doc.remove_namespaces!\n\n # In the results, get all <baseURL> tags which contain \"/request\". \n # DSpace OAI interfaces tend to look like this [dspace.url]/oai/request\n links = doc.xpath(\"//baseURL[contains(.,'/request')]\")\n # Get size of result set\n puts \" Results found: #{links.length}\"\n\n # Loop through each result\n links.each do |link|\n # Get result URL\n url = link.content.to_s\n\n # Save URL to our results set, with a source of \"OpenDOAR\"\n results << [ \"#{registry_name} OAI-PMH Registry\", url ]\n end\n\n return results\nend", "def search(email_option, email, postcode_option, postcode)\n email = sanitise_email(email)\n postcode = sanitise_postcode(postcode)\n\n query = Person.joins(:postcode)\n if(email_option == 'include' && email )\n query = query.where(:email_domain => email)\n elsif(email_option == 'exclude' && email )\n query = query.where(\"email_domain NOT IN (?)\", email)\n end\n\n if(postcode_option == 'include' && postcode)\n query = query.where(:postcodes => {:number => postcode})\n elsif(postcode_option == 'exclude' && postcode)\n query = query.where(\"postcodes.number NOT in (?)\", postcode )\n end\n\n return query.order(:name).all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Searches enquiries based on agents or agencies.
def enquiries_search_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...' end # resource path local_var_path = '/v1/enquiries' # query parameters query_params = {} query_params[:'agencyId'] = opts[:'agency_id'] if !opts[:'agency_id'].nil? query_params[:'agentId'] = opts[:'agent_id'] if !opts[:'agent_id'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'text/html', 'application/xml', 'text/xml']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<DomainPublicAdapterWebApiModelsV1EnquiriesEnquiryReport>') if @api_client.config.debugging @api_client.config.logger.debug "API called: EnquiriesApi#enquiries_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
[ "def enquiries_search(opts = {})\n data, _status_code, _headers = enquiries_search_with_http_info(opts)\n data\n end", "def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end", "def agencies_search(q, opts = {})\n data, _status_code, _headers = agencies_search_with_http_info(q, opts)\n data\n end", "def officers(q, items_per_page = nil, start_index = nil)\n params = {q: q,\n items_per_page: items_per_page,\n start_index: start_index}\n client.get(\"search/officers\", params)\n end", "def search(params)\n\n search_text = params[:'search-text'] || \"web developer\"\n search_location = params[:'search-location'] || \"Boston, MA\"\n start_date = params[:'start-date'] || Date.today\n\n start_date = Date.strptime(start_date) if start_date.is_a?(String)\n\n search_form = get_search_form\n\n search_form.q = search_text\n search_form.l = search_location\n\n response = @agent.submit(search_form)\n\n #job_list = scrape_jobs( sort_by_date( response ) ) # see below\n job_list = scrape_jobs( response )\n\n results = []\n\n job_list.each_entry do |job|\n results << scrape_details(job, start_date)\n end\n\n results\n\n end", "def search_for_applications(to_date = Date.today, from_date = to_date - 14, agent = get_user_agent)\n # Tell the user what we're doing\n log \"Searching for applications between #{from_date} and #{to_date}\"\n\n # Get the search page and submit the search\n search_page = agent.get(\"http://planning.northamptonboroughcouncil.com/Planning/lg/GFPlanningSearch.page?org.apache.shale.dialog.DIALOG_NAME=gfplanningsearch&Param=lg.Planning\")\n search_form = search_page.form_with(:id => \"_id122\")\n search_form[\"_id122:SDate1From\"] = from_date.strftime(\"%d/%m/%Y\")\n search_form[\"_id122:SDate1To\"] = to_date.strftime(\"%d/%m/%Y\")\n search_button = search_form.button_with(:id => \"_id122:_id180\")\n search_results = agent.submit(search_form, search_button)\n \n # Process the results - will recursively fetch additional pages\n process_search_results(agent, to_date, from_date, search_results)\nend", "def agencies_search_with_http_info(q, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgenciesApi.agencies_search ...'\n end\n # verify the required parameter 'q' is set\n if @api_client.config.client_side_validation && q.nil?\n fail ArgumentError, \"Missing the required parameter 'q' when calling AgenciesApi.agencies_search\"\n end\n # resource path\n local_var_path = '/v1/agencies'\n\n # query parameters\n query_params = {}\n query_params[:'q'] = q\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/json', 'text/html', 'application/xml', 'text/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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<DomainAgencyServiceV2ModelAgencySummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgenciesApi#agencies_search\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @q = Merchant::AcquirerOrg.search(params[:q])\n @merchant_acquirer_orgs = @q.result.order(created_at: :desc).paginate(page: @page, per_page: @limit)\n end", "def search_for_companies\n populate_company_data\n company_search\n end", "def search_inspections\n search_business_context( true )\n end", "def search\n query = search_params.select{|k,_| PERMITTED_KEYS.include? k}\n if query['result_types'].present?\n query['result_types'].select!{|k| RESULT_TYPES.include? k}\n else\n query['result_types'] = ['claim'] # claim is default search type\n end\n\n @submission_results, @claim_results = nil, nil\n if query['result_types'].include?('submission')\n submission_query = query.select{|k,_| SUBMISSION_QUERY_KEYS.include? k}\n @submission_results = Submission.where(submission_query)\n end\n\n if query['result_types'].include?('claim')\n claim_query = query.select{|k,_| CLAIM_QUERY_KEYS.include? k}\n @claim_results = Claim.where(claim_query)\n if query['from'] && query['to']\n @claim_results = @claim_results.joins(:services).where(services: {date: query['from']..query['to']})\n elsif query['from']\n @claim_results = @claim_results.joins(:services).where('services.date > ?', query['from'])\n elsif query['to']\n @claim_results = @claim_results.joins(:services).where('services.date < ?', query['to'])\n end\n @claim_results = @claim_results.uniq\n end\n end", "def enable_search_on(*attributes)\n self.instance_eval do\n get SEARCH_ROUTE do\n retrieve_resources '' do |resource|\n\n pass if !involved? || params[:q].blank? || params[:q].size > 100\n\n terms = params[:q].split(/[\\+ ]/)\n search_terms = []\n\n # Seperate terms to match\n terms.each do |term|\n attributes.each do |attr|\n search_terms << resource.arel_table[attr.to_sym].matches(\"%#{term}%\")\n end\n end\n\n resource.where(search_terms.reduce(:or)).limit(100).\n flatten.as_json(read_scope)\n end\n end\n end\n end", "def search_for_active_organizations(**args)\n search_for_organizations(historic: false, **args)\n end", "def enquiries\n #cache_response(params[:udprn].to_i, [params[:page], params[:buyer_id], params[:qualifying_stage], params[:rating], params[:archived], params[:closed], params[:count]]) do\n page = params[:page]\n page ||= 0\n page = page.to_i\n udprn = params[:udprn].to_i\n count = params[:count].to_s == 'true'\n is_premium = @current_user.is_premium rescue false\n old_stats_flag = (params[:old_stats_flag].to_s == 'true')\n profile = @current_user.class.to_s\n event_service = EventService.new(udprn: udprn, buyer_id: params[:buyer_id], \n last_time: params[:latest_time], qualifying_stage: params[:qualifying_stage],\n rating: params[:rating], archived: params[:archived], is_premium: is_premium, \n closed: params[:closed], count: count, profile: profile, old_stats_flag: old_stats_flag)\n if @current_user.is_a?(Agents::Branches::AssignedAgent) && event_service.details[:agent_id].to_i != @current_user.id\n render json: { message: 'The agent does not belong to the property' }, status: 400\n else\n enquiries = event_service.property_specific_enquiry_details(page)\n render json: enquiries, status: 200\n end\n #end\n end", "def find_jobs_by_term\n\n print \"\\nEnter a search term to filter jobs by: \".blue\n search_term = gets.strip\n\n jobs = FreelancerFinder::Job.all.find_all do |job|\n job.title.include?(\"#{search_term}\") || job.short_description.include?(\"#{search_term}\") || !!job.tags.detect {|tag| tag.include?(\"#{search_term}\")}\n end\n\n jobs\n end", "def search(keywords, *fields)\n return all\n end", "def search_expenses\n if tag_ids\n @expenses = Expenses::Query.index_includes Expense.any_tags(*tag_ids)\n else\n @expenses = Expenses::Query.new.index(params).order('date desc, accounts.id desc')\n end\n\n set_expenses_filters\n @expenses = @expenses.page(@page)\n end", "def oai_registry_search(registry_name, xml_interface)\n results = Array.new\n\n # If OAI Regsitry is disabled in global config, just return no results\n return results if !$oai_registry\n\n puts \"---------------------\"\n puts \"Querying #{registry_name} OAI-PMH registry for likely DSpace sites ...\"\n puts \"(using XML interface at: #{xml_interface})\"\n\n # Request the full registry in XML & check return status\n open_page = open(xml_interface)\n puts \" Status returned: #{open_page.status.join(' ')}\"\n\n # Parse the response as XML\n doc = Nokogiri::XML(open_page)\n # Remove namespaces from result, as Nokogiri gets confused by their XML namespaces\n doc.remove_namespaces!\n\n # In the results, get all <baseURL> tags which contain \"/request\". \n # DSpace OAI interfaces tend to look like this [dspace.url]/oai/request\n links = doc.xpath(\"//baseURL[contains(.,'/request')]\")\n # Get size of result set\n puts \" Results found: #{links.length}\"\n\n # Loop through each result\n links.each do |link|\n # Get result URL\n url = link.content.to_s\n\n # Save URL to our results set, with a source of \"OpenDOAR\"\n results << [ \"#{registry_name} OAI-PMH Registry\", url ]\n end\n\n return results\nend", "def search(email_option, email, postcode_option, postcode)\n email = sanitise_email(email)\n postcode = sanitise_postcode(postcode)\n\n query = Person.joins(:postcode)\n if(email_option == 'include' && email )\n query = query.where(:email_domain => email)\n elsif(email_option == 'exclude' && email )\n query = query.where(\"email_domain NOT IN (?)\", email)\n end\n\n if(postcode_option == 'include' && postcode)\n query = query.where(:postcodes => {:number => postcode})\n elsif(postcode_option == 'exclude' && postcode)\n query = query.where(\"postcodes.number NOT in (?)\", postcode )\n end\n\n return query.order(:name).all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use this method to tell the server this plugin defines additional HTTP methods. This method is passed a uri. It should only return HTTP methods that are available for the specified uri.
def http_methods(_path) [] end
[ "def http_methods(uri)\n tree = @server.tree\n\n if tree.node_exists(uri)\n node = tree.node_for_path(uri)\n return ['PATCH'] if node.is_a?(IPatchSupport)\n end\n []\n end", "def http_methods(uri)\n begin\n node = @server.tree.node_for_path(uri)\n rescue Dav::Exception::NotFound\n return []\n end\n\n return ['POST'] if node.is_a?(IOutbox)\n\n []\n end", "def set_request_type(method, uri)\n case method\n when :delete\n Net::HTTP::Delete.new(uri)\n when :get\n Net::HTTP::Get.new(uri)\n when :post\n Net::HTTP::Post.new(uri)\n when :put\n Net::HTTP::Put.new(uri)\n end\n end", "def method_missing(method, *args)\n @uri.path = \"/#{args[0]}.#{@format.extension}\" # Should be the form of /resources\n if verb = method.to_s.match(/^http_(get|post|put|delete|head)$/)\n run_verb(verb.to_s.split(\"_\").last, args[1])\n end\n end", "def available_methods\n list = []\n list << \"GET\" if self.respond_to? :on_get\n list << \"POST\" if self.respond_to? :on_post\n list << \"PUT\" if self.respond_to? :on_put\n list << \"DELETE\" if self.respond_to? :on_delete\n list\n end", "def supported_http_methods(methods)\n if methods == :any\n @options[:supported_http_methods] = :any\n elsif Array === methods && methods == (ary = methods.grep(String).uniq) &&\n !ary.empty?\n @options[:supported_http_methods] = ary\n else\n raise \"supported_http_methods must be ':any' or a unique array of strings\"\n end\n end", "def http_methods\n reload if executed_requests['GET'].nil? || executed_requests['GET']['headers'].nil? || executed_requests['GET']['headers'].empty?\n (executed_requests['GET']['headers']['Allow'] || \"GET\").split(/,\\s*/)\n end", "def route(uri)\n return false if forbids?(uri)\n\n @routes.each do |route|\n is_matching, params = route.rule.invoke(uri)\n return route.method, params if is_matching && params\n end\n\n false\n end", "def http_methods\n ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS']\n end", "def default_http_method(*args)\n\t\t\ts = 'Method not allowed.'\n\t\t\t[405,\n\t\t\t\t{ 'Allow' => http_methods.join(', '),\n\t\t\t\t 'Content-Type' => 'text/plain',\n\t\t\t\t 'Content-Length' => s.bytesize.to_s,\n\t\t\t\t},\n\t\t\t\t['Method not allowed.']]\n\t\tend", "def allowed_methods( path_components )\n\t\ttype = path_components.empty? ? :collection : :single\n\t\tallowed = HTTP_METHOD_MAPPING[ type ].keys.\n\t\t\tfind_all {|msym| self.respond_to?(msym) }.\n\t\t\tinject([]) {|ary,msym| ary << HTTP_METHOD_MAPPING[type][msym]; ary }\n\n\t\tallowed += ['HEAD'] if allowed.include?( 'GET' )\n\t\treturn allowed.uniq.sort\n\tend", "def method_missing(method_name, *arguments, &block)\n if method_name.to_s =~ /(post|get|put|patch|delete)/\n request($1.to_sym, *arguments, &block)\n else\n super\n end\n end", "def handle_http_method(http_method, extra_path)\n extra_path = CGI.unescape(extra_path)\n case http_method\n when \"GET\"\n self.on_get extra_path\n when \"POST\"\n self.on_post extra_path\n when \"PUT\"\n self.on_put extra_path\n when \"DELETE\"\n self.on_delete extra_path\n end #case \n end", "def custom_request(verb, uri, params = {}, env = {}, &block)\n uri = parse_uri(uri, env)\n env = env_for(uri, env.merge(method: verb.to_s.upcase, params: params))\n process_request(uri, env, &block)\n end", "def http_method_string\n case http_method&.to_sym\n when :_get then 'GET'\n when :_post then 'POST'\n when :_patch then 'PATCH'\n when :_delete then 'DELETE'\n end\n end", "def handlers\n HTTP_METHODS.map do |sym|\n [sym, send(sym)]\n end\n end", "def http_method_allowed?(verb=@base.method_value)\n @base.allowed_http_methods.include?(verb)\n end", "def merge_http_methods!(methods)\n self.http_methods |= methods\n end", "def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a bunch of metadata about the plugin. Providing this information is optional, and is mainly displayed by the Browser plugin. The description key in the returned array may contain html and will not be sanitized.
def plugin_info { 'name' => plugin_name, 'description' => nil, 'link' => nil } end
[ "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav server',\n 'link' => 'http://sabre.io/dav/browser-plugin/'\n }\n end", "def plugin_meta(slice=nil)\n # see http://www.tiddlywiki.com/#ExamplePlugin\n if not @plugin_meta\n meta = %w[Name Description Version Date Source Author License CoreVersion Browser]\n @plugin_meta = get_slices.reject{|k,v| not meta.include?(k)}\n end\n if slice\n @plugin_meta[slice]\n else\n @plugin_meta\n end\n end", "def package_information\n puts\n puts \"%30s%s\" % [\"Plugin information : \", @package.metadata[:name]]\n puts \"%30s%s\" % [\"-\" * 22, \"-\" * 22]\n puts \"%30s%s\" % [\"Plugin Type : \", @package.plugintype.capitalize]\n puts \"%30s%s\" % [\"Package Output Format : \", @package_type.upcase]\n puts \"%30s%s\" % [\"Version : \", @package.metadata[:version]]\n puts \"%30s%s\" % [\"Iteration : \", @package.iteration]\n puts \"%30s%s\" % [\"Vendor : \", @package.vendor]\n puts \"%30s%s\" % [\"Post Install Script : \", @package.postinstall] if @package.postinstall\n puts \"%30s%s\" % [\"Author : \", @package.metadata[:author]]\n puts \"%30s%s\" % [\"License : \", @package.metadata[:license]]\n puts \"%30s%s\" % [\"URL : \", @package.metadata[:url]]\n\n if @package.packagedata.size > 0\n @package.packagedata = @package.packagedata.select{|k, v| v != nil}\n @package.packagedata.each_with_index do |values, i|\n if i == 0\n puts \"%30s%s\" % [\"Identified Packages : \", values[0]]\n else\n puts \"%30s%s\" % [\" \", values[0]]\n end\n end\n end\n end", "def metadata\n {\n title: flickr_title,\n description: description\n }\n end", "def description\n fetch('phobia.descriptions')\n end", "def description\n @plugin = Plugin.find(params[:id])\n @info = @plugin.wp_info\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: { plugin: @plugin, info: @info } }\n end\n end", "def plugin_description\n @plugin_description ||= \"#{Vmdb::Appliance.PRODUCT_NAME} plugin for the #{provider_name.titleize} provider.\"\n end", "def description\n\t\tmodule_info['Description']\n\tend", "def all_meta_description_content\n return unless @page\n tags = []\n @page.css(\"meta[name='description']\").each do |t|\n tags << t['content']\n end\n tags\n end", "def detect_description\n doc = Nokogiri::HTML @browser.get_html @url.url do |config|\n config.noerror\n end\n\n doc.css('script, link, style').each { |node| node.remove } # Strip out stuff with text content that isn't actual content\n\n description = begin\n doc.css('meta[name=description]').attr('value').to_s\n rescue\n doc.css('body').text\n .gsub(/\\r|\\n|\\t/, ' ')\n .squeeze(' ') rescue nil\n end\n\n description[0..1000]\n end", "def meta_description\n description = current_page.data.meta_description\n description ? description : \"\"\n end", "def page_meta\n res = ''\n res << tag(:meta, :name => 'description', :content => @_desc) if @_desc\n res << tag(:meta, :name => 'keywords', :content => @_keys) if @_desc\n return res\n end", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def metadata\n @metadata.map { |key, value| {:name => key, :content => value } } rescue nil\n end", "def all_descriptions\n result = []\n @pages.each do |page|\n result << [page.page_url, page.meta_desc_content] if page.page_a_tags\n end\n result\n end", "def dump_info()\n m = get_meta()\n puts \"Version : #{m::VERSION}\"\n puts \"Copyright : #{m::COPYRIGHT}\"\n puts \"Title : #{m::TITLE}\"\n puts \"URI : #{uri}\"\n end", "def metadata\n value_of(:metadata, JSON.method(:pretty_generate), '{}')\n end", "def meta\n tags = driver.all(:css, 'meta[name]')\n tags.inject(Hash.new) do |vals, tag|\n vals[tag.attribute(:name)] = tag.attribute(:content) if tag.attribute(:name)\n vals\n end\n end", "def descriptions\n @descriptions ||= {}\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use in auth_rules(examquestion) return [programme_id] for academician
def lecturers_programme mypost = Position.find(:first, :conditions => ['staff_id=?',staff_id]) myunit = mypost.unit postbasics=['Pengkhususan', 'Pos Basik', 'Diploma Lanjutan'] post_prog=Programme.find(:all, :conditions => ['course_type IN(?)', postbasics]) dip_prog=Programme.find(:all, :conditions => ['course_type=?', 'Diploma']).map(&:name) if dip_prog.include?(myunit) programmeid=Programme.roots.find(:all, :conditions => ['name=?', myunit]).map(&:id) else if myunit=="Pengkhususan" && roles.map(&:authname).include?("programme_manager") programmeid=post_prog.map(&:id) elsif postbasics.include?(myunit) post_prog.map(&:name).each do |pname| @programmeid=Programme.roots.find(:all, :conditions => ['name=?', pname]) if mypost.tasks_main.include?(pname).pluck(&:id) end programmeid=@programmeid else programmeid=0 #default val for admin, common_subjects lecturer too end end programmeid end
[ "def get_quiz_id(assessment_division)\n if assessment_division.is_a?(Quiz)\n return assessment_division.id\n else\n return assessment_division.quiz_id\n end\n\n end", "def get_instructor_id\n Questionnaire.find_by(id: node_object_id).try(:instructor_id)\n end", "def transform_question_id(store)\n src_coding_id = assessment_answer.assessment_question.as_question_id\n dst_coding_id = store.get(V1::AssessmentCodingQuestion.table_name, src_coding_id)\n ::Course::Assessment::Question.\n find_by(actable_id: dst_coding_id,\n actable_type: ::Course::Assessment::Question::Programming.name).try(:id)\n end", "def select_programme(programme)\n session[:programme_id] = programme.id\n end", "def basic_authorise(program, user)\n begin\n user = User.find_by_user_name(user) if user.class.to_s == \"String\"\n program = Program.find_by_program_name(program) if program.class.to_s == \"String\"\n #puts \"-----( \" + program.id.to_s + \",\" + user.id.to_s + \" )-------\"\n record = ProgramUser.find_by_program_id_and_user_id(program.id, user.id)\n\n return record != nil\n rescue\n puts \"Basic Authorisation exception: \" + $!.to_s\n return false\n end\n end", "def get_exam_number\n @datasets.each do |ds|\n return ds.exam_number unless ds.exam_number.nil?\n end\n # raise(IOError, \"No valid study id / exam number found.\")\n end", "def applicant_id\n applicants.empty? ? nil : applicants.first.application_for_offering_id\n end", "def learner_user_id\n return @learner_user_id\n end", "def question_id\n return @question_id\n end", "def transform_question_id(store)\n src_qn_id = assessment_answer.assessment_question.as_question_id\n dst_qn_id = store.get(AssessmentScribingQuestion.table_name, src_qn_id)\n ::Course::Assessment::Question.\n find_by(actable_id: dst_qn_id,\n actable_type: ::Course::Assessment::Question::Scribing.name).try(:id)\n end", "def get_existing_exam(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_WITH_ID % [user_id, course_id, exam_id])\r\n end", "def guard_skill_id\r\n return 2\r\n end", "def current_user_lifestyle_id\n lifestyle_string = current_user.deet.lifestyle\n Lifestyle.where(types: lifestyle_string).map(&:id)\n end", "def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end", "def professor_of\n Course.find_all_by_user_id(id)\n end", "def selected_programme\n @current_programme ||= Programme.find_by(id: session[:programme_id])\n end", "def get_id(course_name, term, year)\n course = Course.find_by_name(course_name)\n semester = Semester.where(:term => term, :year => year).first\n if course and semester\n coursem = Coursem.where(:course_id => course.id, :semester_id => semester.id).first\n if coursem\n return coursem.id\n end\n end\n return nil\n\n end", "def validate_quiz\n\n # Get the number of quiz questions from the assignment\n num_quiz_questions = Assignment.find(params[:aid]).num_quiz_questions\n\n # Construct a quiz questionnaire from parameters\n questionnaire = quiz_questionnaire num_quiz_questions\n\n # If valid, return\n if questionnaire.valid?\n return questionnaire\n end\n\n # Not valid, return errors\n questionnaire_errors questionnaire\n end", "def appt_id\n @appt_id ||= base_qm.dig(:appointment, 'id')\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
maps a score to 3 rgb values
def scoreToColor(score, minVal, maxVal) maxColor = 230.0 minColor = 10.0 norm = (((score.to_f - minVal ) / (maxVal - minVal ) ) * (maxColor - minColor)) + minColor norm = [maxColor, norm].min return [minColor, norm, norm] end
[ "def get_color_from_score(score, lod_score, use_dprime)\n color = 'white'\n if use_dprime then\n if lod_score > 2\n if score < 0.5\n # high LOD, low D'\n color = \"rgb(255,224,244)\"\n else\n # high LOD, high D' => shades of red\n blue_green = (255-32)*2*(1-score)\n color = sprintf(\"rgb(255, %d, %d)\", blue_green, blue_green)\n end\n elsif(score > 0.99)\n #high LD, low LOD blueish color\n color = \"rgb(192,192,240)\"\n else\n color = 'white'\n end\n else # use rsquared\n red_blue_green = 255 * (1.0 - score)\n color = sprintf(\"rgb(%d,%d,%d)\", red_blue_green, red_blue_green, red_blue_green)\n end\n return color\n end", "def color_map\n {\n 'high_risk_ice_check_in' => '#800080',\n 'friend_in_detention' => '#e83737',\n }\n end", "def rgb(r, g, b)\n \"%.2X%.2X%.2X\" % [r,g,b].map{|i| [[i,255].min,0].max}\nend", "def triple_score(face)\n points = { 1 => 1000, 2 => 200, 3 => 300, 4 => 400, 5 => 500, 6 => 600 }\n points[face] || 0\n end", "def color(score)\n return \"secondary\" if score.nil?\n\n if score < 0.33\n \"danger\"\n elsif score < 0.66\n \"warning\"\n else\n \"success\"\n end\n end", "def rank_color(match)\n rank = choice_num(match)\n if (rank <= 3)\n \"bg-green\"\n elsif (rank <=6)\n \"bg-yellow\"\n else\n \"bg-red\"\n end\n end", "def color\n #Untested\n count = self.user_rings.count\n parts = count - 1\n rgb = Hash.new\n rgb[:green] = 0\n if self.number == 1\n logger.info \"test: number is one\"\n rgb[:red] = 0\n rgb[:blue] = 255\n elsif self.number == count\n logger.info \"test: number is count\"\n rgb[:red] = 255\n rgb[:blue] = 0\n else\n logger.info \"test: count = #{count}, number = #{self.number}\"\n rgb[:red] = 256*(self.number-1)/parts - 1\n rgb[:blue] = 256*(parts-self.number+1)/parts - 1 \n end\n return rgb\n end", "def color_value\n case threshold_value\n when 3 then 'Red'\n when 2 then 'Yellow'\n when 1 then 'Green'\n else 'Gray'\n end\n end", "def to_rgb \r\n return red, green, blue\r\n end", "def color_matches(loc=@counter)\n code = get_code_remainder(loc)\n guess = get_guess_remainder(loc)\n x = 0\n y = 0\n index = 0\n totalmatches = 0\n matches = 0\n guess.each{|g|\n code.each{ |c| \n if c == g && matches == 0\n matches += 1\n guess[x] = 0\n code[y] = 5\n end\n y += 1\n }\n y = 0\n totalmatches += 1 if matches > 0\n matches = 0\n x += 1\n }\n totalmatches\n end", "def red\n @r * 255.0\n end", "def color\n @hash[23..32].scan(/([\\w\\d])([\\w\\d])([\\w\\d])/).map do |arr|\n color = 0\n # Convert every character to a two-digit number, then get second digit\n arr.each_with_index do |c, i|\n color += 10**i * c.to_i(36)\n end\n color % 256\n end\n end", "def grayscale(c)\n (c[0]*0.3 + c[1]*0.59 + c[2]*0.11).to_i\n end", "def color_matches(code, guess)\n colormatches = 0\n guess.each{ |num| colormatches += 1 if code.any?{|x| x == num} }\n colormatches\n end", "def color(category)\n score = overall(category)\n if score > 3.5\n color = \"#73BF8F\"\n elsif score > 2.5\n color = \"#FFE270\"\n else\n color = \"#F1807E\"\n end\n color\n end", "def setup_scores\n score = -1\n ('A' .. 'Z').to_a.map!{\n |l|\n score += 1\n result = [l, score]\n if score == 4\n score = -1;\n end\n result\n }\n end", "def convert_code\n @code.map{ |num| translate_num_to_color(num) }\n end", "def colour_map(uri)\n namespace = fetch_namespace(uri)\n if(!@colour_map.has_key?(namespace))\n color = \"#\"+\"%06x\" % (rand * 0xffffff)\n @colour_map.store(namespace,color)\n else\n color = @colour_map.fetch(namespace)\n end\n return color\n end", "def to_rgb\n x,y,z = lab_to_xyz(@l,@a,@b)\n r,g,b = xyz_to_rgb(x,y,z)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find parts that are definitely required and should raise an error if they're not present
def __required_parts required = [] required << 'body' if (@spec['body'] && @spec['body']['required']) # Get required variables from paths: req_variables = __path_variables.inject(:&) # find intersection required << req_variables unless req_variables.empty? required.flatten end
[ "def parse_required_parts(spec)\n required = []\n return required if @endpoint_name == 'tasks.get'\n\n required << 'body' if (spec['body'] && spec['body']['required'])\n # Get required variables from paths:\n req_variables = parse_path_variables.inject(:&) # find intersection\n required << req_variables unless req_variables.empty?\n required.flatten\n end", "def required_steps\n filter_steps{ |params| params.any?{ |p| p.required? } }\n end", "def check_required_parameters()\n params_good = true\n @required_parameters.each do |req_par|\n passed_reqpar = get_arg_value(req_par)\n if passed_reqpar.nil? || passed_reqpar == \"\"\n params_good = false\n end\n end\n\n has_atleast_one = true\n if @requires_atleast_one.size > 0\n has_atleast_one = false\n @requires_atleast_one.each do |least_one|\n luno = get_arg_value(least_one)\n if ! luno.nil? && luno != \"\"\n has_atleast_one = true\n end\n end\n end\n\n if !params_good || ! has_atleast_one\n puts \"Missing parameters: #{@required} #{params_good} && #{has_atleast_one}\"\n exit(1)\n end\n\n end", "def required_component_dependencies\n resolve_components!\n\n validate_components!\n\n component_dependencies required_components.to_a\n end", "def validate_requireds!\n missing = []\n required_params.each do |param|\n missing << param if self[param].nil?\n end\n raise \"Missing values for #{missing.map{|s| s.to_s }.sort.join(\", \")}\" if (! missing.empty?)\n end", "def requirements(data, required, properties, elements)\r\n required.each do |i|\r\n if (i < properties.size and (data[i].nil? and elements) or\r\n (data.is_a?(Hash) and data[properties[i]].nil? and not elements))\r\n Kernel.print(\"Error Loading Data \\n#{properties[i]} is not defined\")\r\n exit\r\n end\r\n end\r\n end", "def assume_parts\n # Check if unit is in street number\n # 1) If street number has - or / unit is the smallest length\n # 2) If street number is all nums except 1 letter, letter is unit\n search_for_unit_in_street_num if @parts[:unit].nil? && @parts[:street_number]\n\n # Search for the street_name elsewhere\n search_for_street_name if @parts[:street_name].nil?\n\n # set puerto rico as the state\n @parts[:state] = @parts[:country] if @parts[:state].nil? && @parts[:country] == 'pr'\n\n return if @parts[:bus].nil? || @parts[:bus].empty?\n\n search_for_label_in_bus if @parts[:street_label].nil?\n search_for_state_in_bus if @parts[:state].nil?\n\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def check_required_attributes\n attributes = DSL.attributes.values.select(&:required?)\n attributes.each do |attr|\n value = spec.send(attr.name)\n unless value && (!value.respond_to?(:empty?) || !value.empty?)\n if attr.name == :license\n results.add_warning('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n else\n results.add_error('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n end\n end\n end\n end", "def ensure_par(req, msg = '%<name>s is mandatory: please provide %<flag>s')\n req.each do |k, v|\n raise (msg % { name: k, flag: v }) if self[k].nil?\n end\n end", "def check_required_attrs\n # In this we need to compare what we define in\n # required_attr(*attrs) against what we have defined in\n # the mutation vs what we pass into the run() definition\n errors = []\n puts 'Mutant::check_required_attrs'\n self.required_attr.each do |attr|\n if !self.respond_to?(attr)\n # Our attribute is not defined on our mutation class\n # So we will build the error to return to the run()\n # method, which can determine how we proceed\n err = MutationMissingRequiredVarException.new(\n msg=\"A property that is marked as required is not defined on the mutation: #{attr}\",\n prop=attr)\n errors << err\n end\n end\n errors\n end", "def missing_fields #{{{\n missing = []\n REQUIRED.each do |field|\n missing << field if send(field).nil?\n end\n missing.length > 0 ? missing : nil\n end", "def check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end", "def requires(*args)\n missing = missing_attributes(args)\n if missing.length == 1\n raise ArgumentError, \"#{missing.first} is required for this operation\"\n elsif missing.any?\n raise ArgumentError, \"#{missing[0...-1].join(', ')} and #{missing[-1]} are required for this operation\"\n end\n end", "def missing_mandatory_fields\n mandatory_fields.map do |f|\n return f unless @fields.keys.include?(f)\n end.reject {|f| f.nil? }\n end", "def triggered_mandatory_missing\n qs = survey.sections.map(&:questions).flatten\n ds = Dependency.all(:include => :dependency_conditions, :conditions => {:dependency_conditions => {:question_id => qs.map(&:id) || responses.map(&:question_id)}})\n triggered = qs - ds.select{|d| !d.is_met?(self)}.map(&:question)\n triggered_mandatory = triggered.select{|q| q.mandatory?}\n triggered_mandatory_completed = triggered.select{|q| q.mandatory? and is_answered?(q)}\n triggered_mandatory_missing = triggered_mandatory - triggered_mandatory_completed\n return triggered_mandatory_missing\n end", "def ensure_requirements(template)\n t_leader = Util.read_file(template).split(/^#/)[0].strip\n if t_leader.length > 0\n t_meta = t_leader.get_metadata\n\n if t_meta.key?('required')\n required = t_meta['required'].strip.split(/\\s*,\\s*/)\n required.each do |req|\n unless @metadata.keys.include?(req.downcase)\n Howzit.console.error %({bRw}ERROR:{xbr} Missing required metadata key from template '{bw}#{File.basename(template, '.md')}{xr}'{x}).c\n Howzit.console.error %({br}Please define {by}#{req.downcase}{xr} in build notes{x}).c\n Process.exit 1\n end\n end\n end\n end\n end", "def validate_required_arguments?(skip_validations)\n return if [true, :requires].include?(skip_validations)\n requires.any?\n end", "def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set locales and regions
def set(locales = nil, regions = nil) @Locales = locales unless locales.nil? @Regions = regions unless regions.nil? self end
[ "def available_locales=(locales); end", "def configure(&block)\n block.call @locale\n end", "def setLocale\n if @lOptions.count\n @lOptions.each do | key, value |\n case key\n when :locale_group\n @lgrp = @@lOptions[:locale_group]\n when :locale_language\n @lang = @lOptions[:locale_language]\n when :locale_country\n @ctry = @lOptions[:locale_country]\n when :locale_descriptor\n @desc = @lOptions[:locale_descriptor]\n end\n end\n end\n end", "def set_locale\n set_locale_or_default(params[:locale])\n end", "def set_individual_locale\n I18n.locale = preference[:locale] if preference[:locale]\n end", "def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end", "def i18n_set_locale(locale, &blk)\n locale = ::R18n::I18n.default.to_s if locale.nil?\n \n i18n = ::R18n::I18n.new(\n locale, \n ::R18n.default_places, \n off_filters: :untranslated, \n on_filters: :untranslated_html\n )\n ::R18n.set(i18n)\n yield if block_given?\n # return # NB!! needed to enable routes below to work\n end", "def set_locale\n I18n.locale = params['umlaut.locale'.to_sym] || I18n.default_locale\n end", "def set_locale\n I18n.locale = current_user.try(:locale) || locale_from_header\n end", "def localizations=(value)\n @localizations = value\n end", "def apply_locale; end", "def set_locale\n I18n.locale = access_control.user.locale\n end", "def set_visualization_locale(locale=I18n.locale)\n self.visualization_locale = locale.to_s\n end", "def available_locales_set; end", "def set_locale\n I18n.locale = session[:admin_locale] = 'fr'\n end", "def set_locale(name, value)\n talk('SET-LOCALE ' + name + '=' +value)\n end", "def countries_and_regions=(value)\n @countries_and_regions = value\n end", "def set_locale\n if params[:locale].nil?\n if session[:locale].nil?\n I18n.locale = :ar\n else\n I18n.locale = session[:locale]\n end\n else\n I18n.locale = params[:locale]\n session[:locale] = params[:locale]\n end\n end", "def set_locale\n I18n.locale = params[:locale] || request.headers['LANG'] || I18n.default_locale\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If child_id is not set, then link_url is used to find/create a Shadow and set the shadow_id
def create_shadow_if_needed if self.link_url.present? self.shadow = Shadow.special_find_or_create_by_web_url( self.link_url ) if( self.shadow.errors.empty? ) write_attribute(:shadow_id, self.shadow.id) return true else errors.add_to_base( self.shadow.errors.full_messages.to_sentence ) return false end else errors.add(:link_url, "can't be blank" ) return false end end
[ "def generate_new_child_link(resource, attr)\n\t\t\tnil\n\t\tend", "def hydrate_link(parent, name)\n record = get_record(@data, name)\n if record\n link = add_link_properties(parent, name, record)\n else\n puts \"\\e[31mNot found -- #{name}\\e[0m\"\n link = { 'name': name }\n end\n link\n end", "def update_child_permalinks\n if respond_to?(:children)\n self.children.each do |child|\n child.regenerate_permalink!\n child.save!\n end\n end\n end", "def set_permalink\n if parent.present?\n self.permalink = [parent.permalink, name.to_url].join('/')\n else\n self.permalink = name.to_url\n end\n children.each { |c| c.set_permalink; c.save! }\n self.permalink\n end", "def build_attach_link_url child, attached\n path = request.path.match( /detach|attach/) ? request.path.split(\"/\")[0..3].join(\"/\") : request.path\n r_url = path + \"/%i\" % child.id\n attached ? r_url + \"/detach\" : r_url + \"/attach\"\n end", "def build_nested_url(child_name, child_id = nil)\n url = \"#{instance_url}/#{child_name}\"\n url += \"/#{child_id}\" unless child_id.nil?\n url\n end", "def build_nested_url(child_name, child_id = nil)\n url = \"#{self.instance_url}/#{child_name}\"\n url += \"/#{child_id}\" unless child_id.nil?\n url\n end", "def link_child(object)\n #puts \"link child #{object.short_id} with parent #{self.short_id}\"\n if object && object.is_a?(child_class)\n @children << object if !@children.find {|obj| obj.id == object.id }\n end\n end", "def link(parent, child)\n git[sha_path(parent, child)] = [DEFAULT_MODE, child]\n self\n end", "def child_link\n if !@child_link\n child_xml = xml.elements.to_a('child').first\n if !child_xml\n raise Invalid, \"required child element 'child' of #{self} not found\"\n end\n @child_link = parent.child_by_name(\"link[@name=\\\"#{child_xml.text}\\\"]\", Link)\n end\n @child_link\n end", "def add_child_id(id)\n children_ids << id\n end", "def create_child_blip\n #TODO\n end", "def set_ChildID(value)\n set_input(\"ChildID\", value)\n end", "def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end", "def add_child_link(name, child, form_builder)\n fields = escape_javascript(new_child_fields(child, form_builder)) # child = 'person', form_builder = 'f'\n # calling the js function in nested_attributes.js\n\n link_to_function(name, h(\"add_child(this, \\\"#{child}\\\", \\\"#{fields}\\\")\"))\n\n \n# function add_child(element, child_name, new_child) {\n# $(child_name + '_children').insert({\n# bottom: new_child.replace(/NEW_RECORD/g, new Date().getTime())\n# });\n# }\n\n end", "def paste_child\n @obj = Node.find(params[:id])\n node = Basket.basket.first_child\n\n if node\n @obj.insert_child(node)\n end\n\n render 'show'\n end", "def build_prefer_link_url child, preferred\n path = request.path.match( /defer|prefer/) ? request.path.split(\"/\")[0..3].join(\"/\") : request.path\n r_url = path + \"/%i\" % child.id\n preferred ? r_url + \"/defer\" : r_url + \"/prefer\"\n end", "def relist_child_id\n item_hash.deep_find([:listing_details, :relisted_item_id])\n end", "def rewrite_child(child, name = nil)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is used to generate the token from UAA server by providing the UAA url and usename and password.
def get_access_token() if @api_url[4] != "s" temp = @api_url[10..@api_url.length] @uaa_target = "https://uaa#{temp}" else temp=@api_url[11..@api_url.length] @uaa_target = "https://uaa#{temp}" end Dir.chdir @home_directory FileUtils.rm_rf(".uaac.yml") system("uaac target #{@uaa_target} --skip-ssl-validation >> /dev/null") print "Enter email:".yellow @uaa_username = gets.chomp print "Enter password:".yellow @uaa_password = STDIN.noecho(&:gets).chomp puts "" command = system("uaac token get #{@uaa_username} #{@uaa_password}") if command != true puts "" abort("Invalid Credentials.".red) else puts "Token generated Successfully.".green end Dir.chdir @home_directory if Dir.glob(".uaac.yml") != '.uaac.yml' filehandler = File.open('.uaac.yml','r') for line in filehandler do if line[6..17]=="access_token" length_line = line.length @access_token = line[20..length_line] end end else abort("Unable to get Token.".red) end end
[ "def gen_token\n nonce = Array.new(10){rand(0x100000000)}.pack('I*')\n nonce_base64 = [nonce].pack('m').chomp\n now = Time.now.utc.iso8601\n digest = [Digest::SHA1.digest(nonce + now + @password)].pack('m').chomp\n sprintf(%Q<UsernameToken Username=\"%s\", PasswordDigest=\"%s\", Nonce=\"%s\", Created=\"%s\">,\n @username, digest, nonce_base64, now)\n end", "def create_api_token(); self.api_token = SecureRandom.urlsafe_base64(180); end", "def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end", "def create_sandbox_user\n body = { \"providerCallbackHost\": @host }\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser'\n response = Faraday.post(@url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['X-Reference-Id'] = @uuid\n req.headers['Ocp-Apim-Subscription-Key'] = @key\n req.body = body.to_json\n end\n\n unless response.status == 201\n raise Momoapi::Error.new(response.body, response.status)\n end\n\n generate_api_key\n end", "def generate_token\r\n self.token = SecureRandom.base64(15).tr('+/=lIO0', OAUTH_CONSUMER_SECRET)\r\n end", "def create_token\n # Generate a random endpoint for the customer\n endpoint = (0...13).map { ('a'..'z').to_a[rand(26)] }.join\n @token = generate_token endpoint\n end", "def generate_utoken\n self.utoken = loop do\n random_token = SecureRandom.base58(UTOKEN_LENGTH)\n break random_token unless Session.exists?(utoken: random_token)\n end\n end", "def generate_access_token\n token_string = \"#{@username}:#{@password}\"\n return Base64.strict_encode64(token_string)\n end", "def generate_authorization_token\n # create the token that contains the necessary elements to authorize the user\t\n # using a nested array because the alphabetical order must be maintained\n token = [['credentials', self.user.to_credential_string,], ['identity', self.user.to_identity_string], ['time', Time.now.to_i.to_s]]\n encoded_parms = token.collect {|pair| pair[1] = CGI.escape(pair[1]); pair.join('=')}.join('&')\n\n digest = Digest::SHA2.new\n digest.update(encoded_parms)\n\n hmac = HMAC::SHA256.new(self.options[:shared_secret])\n hmac.update(encoded_parms)\n\n # add the hashed digital signature to the end of the query parameters\n encoded_parms += \"&signature=#{hmac.hexdigest}\"\n end", "def get_token(username, password)\r\n\t# build {\"Username\":\"un\", \"Password\":\"pw\"} string\r\n\tjson_service_credentials = JSON.generate({:Username => username, :Password => password})\r\n\r\n\t# send credentials to GetToken endpoint, get token UUID in return\r\n\thttp = Net::HTTP.new($Uri.host, $Uri.port)\r\n\trequest = Net::HTTP::Post.new('/Unity/UnityService.svc/json/GetToken', {'Content-Type' => 'application/json'})\r\n\trequest.body = json_service_credentials\r\n\tresponse = http.request(request)\r\n\tunity_token = response.body\r\n\treturn unity_token\r\nend", "def generate_auth_token\n command = P::GenerateAuthTokenCommand.new\n send_command(:generate_auth_token, command)\n end", "def user_api_token()\n self.class.get('/user/api_token', create_params({}))['result']\n end", "def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end", "def get_uaa_client\n token_issuer = CF::UAA::TokenIssuer.new(@uaaApi, @client_id, @client_secret)\n token = token_issuer.client_credentials_grant()\n\n uaac = CF::UAA::Scim.new(@uaaApi, token.auth_header)\n\n uaac\n end", "def generate_remote_token!\n remote_tokens.create.token\n end", "def token\n t = [@options[:username], @options[:password]].join(':')\n Base64.encode64(t).delete(\"\\r\\n\")\n end", "def generate_authentication_token\n self.authentication_token = SecureRandom.hex(32)\n end", "def generate_request(username, password)\r\n uname = CGI::escape(\"#{@configuration.client_string}\\\\#{username}\")\r\n data = \"grant_type=#{GRANT_TYPE}\"\r\n data << \"&client_id=#{CGI::escape(@configuration.application_id)}\"\r\n data << \"&username=#{uname}&\"\r\n data << \"password=#{CGI::escape(password)}\"\r\n auth2_request(OAUTH_URL, data)\r\n end", "def get_token\n puts \"getting token\"\n uri = URI.parse(\"https://api.netatmo.net/oauth2/token\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n JSON.parse Net::HTTP.post_form(uri, {\n 'grant_type' => 'password',\n 'client_id' => config['client_id'],\n 'client_secret' => config['client_secret'],\n 'username' => config['username'],\n 'password' => config['password'],\n 'scope' => 'read_station'\n }).body\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is used to prompt for getting api url and return the api url.
def get_api_url() print "Enter the API URL(include http:// or https://)::".yellow @api_url = gets.chomp end
[ "def api_url\n api_mode + api_interface\n end", "def get_api_key\n green \"****************************************\"\n green \"****************************************\"\n green \"**** API SETUP TIME! ****\"\n green \"****************************************\"\n green \"****************************************\" \n\n \n puts \"Hey, looks like you need to get an API key from Twitter before you can get started.\"\n puts \"Please hit enter, and I will send you to #{API_SIGNUP_URL} to start the process.\"\n puts \"(If it doesn't work, you can open a browser and paste the URL in manually)\"\n\n puts \"\\nHit Enter to continue.\"\n \n STDIN.readline\n\n Launchy.open(API_SIGNUP_URL)\n # pause to allow any launchy output\n sleep(1)\n\n puts \"\\n\\n\"\n \n print \"\\n\\nPaste the 'API Key' here: \"\n STDOUT.flush\n config[:consumer_key] = STDIN.readline.chomp\n\n print \"Paste the 'API Secret' here: \"\n STDOUT.flush\n config[:consumer_secret] = STDIN.readline.chomp\n\n # reset the client so we can re-init with new OAuth credentials\n reset_client\n \n #\n # capture ctrl-c and exit without a stack trace\n #\n rescue Interrupt => e\n exit\n end", "def api_url\n \"#{protocol}://api:#{api_key}@#{host}/#{api_version}\"\n end", "def api_uri\n @api_uri ||= URI(api_url)\n end", "def api_url\n base_url.concat api_query_parameter\n end", "def url_api\n Guidebox\n end", "def check_url\n self.api.check_url\n end", "def api_url\n @api_url ||= Addressable::URI.new(\n :scheme => scheme, :host => host, :port => port,\n :path => path_with_base(\"/_api\", resource_path)\n ).normalize.to_s\n end", "def api_url\n return nil unless @auth\n\n if @auth.empty?\n warn \"There are no API configurations in #{@auth_file}\"\n return nil\n end\n\n if @auth.keys.size > 1\n warn \"There are #{@auth.keys.size} API configurations in #{@auth_file}\"\n return nil\n end\n\n @auth.keys.first\n end", "def take_url\n puts 'Please enter the url'\n gets.chomp\nend", "def api_url\n 'https://api.geoloqi.com'\n end", "def api_token\n api_token = @options[:api_token] || Git.get_config(KEY_API_TOKEN, :inherited)\n\n if api_token.blank?\n api_token = ask('Pivotal API Token (found at https://www.pivotaltracker.com/profile): ').strip\n Git.set_config(KEY_API_TOKEN, api_token, :local) unless api_token.blank?\n puts\n end\n\n api_token\n end", "def william_api_url\n @william_api_url || ENV['WILLIAM_API_URL']\n end", "def api_info(input, previous_choice)\n ascii.api_header\n info = PublicApinception::API.find_by_title(input)\n \n ascii.api_title\n puts info.title\n ascii.api_description\n puts info.description\n ascii.api_details\n \n selection = <<~HERE\n Auth_type: #{info.auth_type == \"\" ? \"None\" : info.auth_type }\n HTTPS: #{info.https}\n Cors: #{info.cors}\n Link: #{info.link}\n Category: #{info.category}\n \n HERE\n puts selection\n choice = end_menu(previous_choice)\n \n toggle(choice,info.link) || list_apis(choice)\n end", "def api_endpoint\n @config.fetch(:url)\n end", "def top_recipe_URL(user_input, api_key)\n key_word_chain = user_input.split(\" \").map(&:downcase).join(\"%20\")\n recipes_URL = \"https://www.food2fork.com/api/search?key=#{api_key}&q=#{key_word_chain}&page=1\"\n return recipes_URL\nend", "def get_api_key\n puts \"****************************************\"\n puts \"****************************************\"\n puts \"**** API SETUP TIME! ****\"\n puts \"****************************************\"\n puts \"****************************************\" \n \n puts \"Hey, looks like you need to get an API key from Twitter before you can get started.\"\n puts \"Please go to this URL: https://twitter.com/apps/new\"\n\n print \"\\n\\nPaste the 'Consumer Key' here: \"\n STDOUT.flush\n config[:consumer_key] = STDIN.readline.chomp\n\n print \"Paste the 'Consumer Secret' here: \"\n STDOUT.flush\n config[:consumer_secret] = STDIN.readline.chomp\n \n reset_client\n \n #\n # capture ctrl-c and exit without a stack trace\n #\n rescue Interrupt => e\n# exit\n end", "def getApiServerUrl()\n @apiServer\n end", "def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /sysconfigs/1 GET /sysconfigs/1.json
def show @sysconfig = Sysconfig.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @sysconfig } end end
[ "def index\n @sys_configs = SysConfig.all\n end", "def retrieve_system_configuration()\n start.uri('/api/system-configuration')\n .get()\n .go()\n end", "def retrieve_system_configuration()\n start.uri('/api/system-configuration')\n .get()\n .go()\n end", "def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end", "def index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end", "def index\n @system_configs = SystemConfig.all\n end", "def new\n @sysconfig = Sysconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sysconfig }\n end\n end", "def index\n @system_configs = SystemConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @system_configs }\n end\n end", "def show\n @sys_config = SysConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sys_config }\n end\n end", "def index\n @system_configurations = SystemConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_configurations }\n end\n end", "def show\n @sys_config = SysConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @sys_config.to_xml }\n end\n end", "def get_cfg\n get_uri = @controller.get_ext_mount_config_uri(self)\n response = @controller.rest_agent.get_request(get_uri)\n check_response_for_success(response) do |body|\n NetconfResponse.new(NetconfResponseStatus::OK, body)\n end\n end", "def index\n @admin_systemconfigs = Admin::Systemconfig.all\n end", "def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sys_configuration = SysConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sys_configuration }\n end\n end", "def update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_config = SysConfig.new(sys_config_params)\n\n respond_to do |format|\n if @sys_config.save\n format.html { redirect_to sys_configs_url, notice: 'Sys config was successfully created.' }\n format.json { render :show, status: :created, location: @sys_config }\n else\n format.html { render :new }\n format.json { render json: @sys_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def config\n system_config.send(service_name.to_sym) || []\n end", "def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /sysconfigs/new GET /sysconfigs/new.json
def new @sysconfig = Sysconfig.new respond_to do |format| format.html # new.html.erb format.json { render json: @sysconfig } end end
[ "def new\n @sys_configuration = SysConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sys_configuration }\n end\n end", "def new\n @sys_config = SysConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sys_config }\n end\n end", "def new\n @system_config = SystemConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system_config }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_configuration }\n end\n end", "def create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render json: @sysconfig, status: :created, location: @sysconfig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_config = SysConfig.new(sys_config_params)\n\n respond_to do |format|\n if @sys_config.save\n format.html { redirect_to sys_configs_url, notice: 'Sys config was successfully created.' }\n format.json { render :show, status: :created, location: @sys_config }\n else\n format.html { render :new }\n format.json { render json: @sys_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @system_configuration = SystemConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_configuration }\n end\n end", "def create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end", "def create\n @sys_config = SysConfig.new(params[:sys_config])\n\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to(sys_configs_path) }\n format.xml { render :xml => @sys_config, :status => :created, :location => @sys_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sys_configuration = SysConfiguration.new(params[:sys_configuration])\n\n respond_to do |format|\n if @sys_configuration.save\n format.html { redirect_to @sys_configuration, notice: 'Sys configuration was successfully created.' }\n format.json { render json: @sys_configuration, status: :created, location: @sys_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sys_configuration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @system_config = SystemConfig.new(params[:system_config])\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to @system_config, :notice => 'System config was successfully created.' }\n format.json { render :json => @system_config, :status => :created, :location => @system_config }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @site_config = SiteConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_config }\n end\n end", "def new\n @vsconfig = Vsconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vsconfig }\n end\n end", "def create\n @system_config = SystemConfig.new(system_config_params)\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to @system_config, notice: 'System config was successfully created.' }\n format.json { render action: 'show', status: :created, location: @system_config }\n else\n format.html { render action: 'new' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sysconfig }\n end\n end", "def create\n @system_config = SystemConfig.new(system_config_params)\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to system_configs_path, notice: 'System config was successfully created.' }\n format.json { render :show, status: :created, location: @system_config }\n else\n format.html { render :new }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @configtable = Configtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configtable }\n end\n end", "def new\n @slh_config_dir = SlhConfigDir.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slh_config_dir }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /sysconfigs POST /sysconfigs.json
def create @sysconfig = Sysconfig.new(params[:sysconfig]) respond_to do |format| if @sysconfig.save format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' } format.json { render json: @sysconfig, status: :created, location: @sysconfig } else format.html { render action: "new" } format.json { render json: @sysconfig.errors, status: :unprocessable_entity } end end end
[ "def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_config = SysConfig.new(sys_config_params)\n\n respond_to do |format|\n if @sys_config.save\n format.html { redirect_to sys_configs_url, notice: 'Sys config was successfully created.' }\n format.json { render :show, status: :created, location: @sys_config }\n else\n format.html { render :new }\n format.json { render json: @sys_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end", "def create\n @sys_config = SysConfig.new(params[:sys_config])\n\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to(sys_configs_path) }\n format.xml { render :xml => @sys_config, :status => :created, :location => @sys_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sys_configuration = SysConfiguration.new(params[:sys_configuration])\n\n respond_to do |format|\n if @sys_configuration.save\n format.html { redirect_to @sys_configuration, notice: 'Sys configuration was successfully created.' }\n format.json { render json: @sys_configuration, status: :created, location: @sys_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sys_configuration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @system_config = SystemConfig.new(system_config_params)\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to system_configs_path, notice: 'System config was successfully created.' }\n format.json { render :show, status: :created, location: @system_config }\n else\n format.html { render :new }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sysconfig = Sysconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sysconfig }\n end\n end", "def create\n @system_config = SystemConfig.new(params[:system_config])\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to @system_config, :notice => 'System config was successfully created.' }\n format.json { render :json => @system_config, :status => :created, :location => @system_config }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @admin_systemconfig = Admin::Systemconfig.new(admin_systemconfig_params)\n\n respond_to do |format|\n if @admin_systemconfig.save\n format.html { redirect_to @admin_systemconfig, notice: 'Systemconfig was successfully created.' }\n format.json { render :show, status: :created, location: @admin_systemconfig }\n else\n format.html { render :new }\n format.json { render json: @admin_systemconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @system_config = SystemConfig.new(system_config_params)\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to @system_config, notice: 'System config was successfully created.' }\n format.json { render action: 'show', status: :created, location: @system_config }\n else\n format.html { render action: 'new' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sys_configuration = SysConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sys_configuration }\n end\n end", "def index\n @sys_configs = SysConfig.all\n end", "def create\n @sys_setting = SysSetting.new(sys_setting_params)\n\n respond_to do |format|\n if @sys_setting.save\n format.html { redirect_to @sys_setting, notice: 'Sys setting was successfully created.' }\n format.json { render :show, status: :created, location: @sys_setting }\n else\n format.html { render :new }\n format.json { render json: @sys_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end", "def update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end", "def create\n respond_to do |format|\n if @system_configuration.update_attributes(params[:system_configuration])\n format.html do\n redirect_to root_path,\n notice: 'System configuration was successfully created.'\n end\n format.json { render json: @system_configuration, status: :created, location: @system_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @system_configuration.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /sysconfigs/1 PUT /sysconfigs/1.json
def update @sysconfig = Sysconfig.find(params[:id]) respond_to do |format| if @sysconfig.update_attributes(params[:sysconfig]) format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @sysconfig.errors, status: :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end", "def update\n @sys_config = SysConfig.find(params[:id])\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to(@sys_config) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @system_config = SystemConfig.find(params[:id])\n\n respond_to do |format|\n if @system_config.update_attributes(params[:system_config])\n format.html { redirect_to system_configs_url, :notice => 'System config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render json: @sysconfig, status: :created, location: @sysconfig }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n format.html { render :new }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_config = SysConfig.new(sys_config_params)\n\n respond_to do |format|\n if @sys_config.save\n format.html { redirect_to sys_configs_url, notice: 'Sys config was successfully created.' }\n format.json { render :show, status: :created, location: @sys_config }\n else\n format.html { render :new }\n format.json { render json: @sys_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @system_config.update(system_config_params)\n format.html { redirect_to system_configs_path, notice: \"#{@system_config.description} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_systemconfig.update(admin_systemconfig_params)\n format.html { redirect_to edit_admin_systemconfig_path(params[:id]), notice: 'Systemconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_systemconfig }\n else\n format.html { render :edit }\n format.json { render json: @admin_systemconfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sys_setting.update(sys_setting_params)\n format.html { redirect_to @sys_setting, notice: 'Sys setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @sys_setting }\n else\n format.html { render :edit }\n format.json { render json: @sys_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_config = @system.sys_configs.build(params[:sys_config])\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to user_system_sys_config_url(@user, @system, @sys_config) }\n format.xml { head :created, :location => user_system_sys_config_url(@user, @system, @sys_config) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end", "def update\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n if @system_configuration.update_attributes(params[:system_configuration])\n format.html { redirect_to @system_configuration, notice: 'System configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_configuration.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @sysconfig = Sysconfig.find(params[:id])\n @sysconfig.destroy\n\n respond_to do |format|\n format.html { redirect_to sysconfigs_url }\n format.json { head :no_content }\n end\n end", "def create\n @sys_config = SysConfig.new(params[:sys_config])\n\n respond_to do |format|\n if @sys_config.save\n flash[:notice] = 'SysConfig was successfully created.'\n format.html { redirect_to(sys_configs_path) }\n format.xml { render :xml => @sys_config, :status => :created, :location => @sys_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sys_config.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @sysconfig = Sysconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sysconfig }\n end\n end", "def update\n respond_to do |format|\n if @systemsetting.update(systemsetting_params)\n format.html { redirect_to root_path, notice: 'Se Actualizo la Configuracion Correctamente.' }\n else\n format.html { render :edit }\n format.json { render json: @systemsetting.errors, status: :unprocessable_entity }\n end\n end\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def update\n authorize! :update, :configs\n @app_config = AppConfig.first\n respond_to do |format|\n if @app_config.update(app_config_params)\n format.html { redirect_to static_pages_settings_path, notice: 'App config was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_config }\n else\n format.html { render :edit }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sys_configuration = SysConfiguration.new(params[:sys_configuration])\n\n respond_to do |format|\n if @sys_configuration.save\n format.html { redirect_to @sys_configuration, notice: 'Sys configuration was successfully created.' }\n format.json { render json: @sys_configuration, status: :created, location: @sys_configuration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sys_configuration.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /sysconfigs/1 DELETE /sysconfigs/1.json
def destroy @sysconfig = Sysconfig.find(params[:id]) @sysconfig.destroy respond_to do |format| format.html { redirect_to sysconfigs_url } format.json { head :no_content } end end
[ "def destroy\n @sys_config.destroy\n respond_to do |format|\n format.html { redirect_to sys_configs_url, notice: 'Sys config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_configuration = SysConfiguration.find(params[:id])\n @sys_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_configurations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(sys_configs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @system_config.destroy\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_config = SystemConfig.find(params[:id])\n @system_config.destroy\n\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @system_configuration = SystemConfiguration.find(params[:id])\n @system_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to system_configurations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_systemconfig.destroy\n respond_to do |format|\n format.html { redirect_to admin_systemconfigs_url, notice: 'Systemconfig was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_configuration.destroy\n respond_to do |format|\n format.html { redirect_to system_configurations_url, notice: \"System configuration was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end", "def delete(configset_name)\n http_response = http_client.get(\"#{solr_uri.to_s}/admin/configs?action=DELETE&name=#{configset_name}&omitHeader=true\")\n\n parse_and_verify_response(http_response)\n end", "def destroy\n @config1 = Config1.find(params[:id])\n @config1.destroy\n\n respond_to do |format|\n format.html { redirect_to config1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kernel_config.destroy\n respond_to do |format|\n format.html { redirect_to kernel_configs_url, notice: \"Kernel config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_config = Admin::Config.find(params[:id])\n @admin_config.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_configs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @app_config.destroy\n respond_to do |format|\n format.html { redirect_to app_configs_url, notice: 'App config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: \"Config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @vsconfig = Vsconfig.find(params[:id])\n @vsconfig.destroy\n\n respond_to do |format|\n\n # ActiveRecord::Schema.drop_table @vsconfig.table_name\n\n format.html { redirect_to vsconfigs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @otg_config.destroy\n respond_to do |format|\n format.html { redirect_to otg_configs_url, notice: 'Otg config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @oa_config.destroy\n respond_to do |format|\n format.html { redirect_to oa_configs_url, notice: 'Oa config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /defenses GET /defenses.json
def index @defenses = Defense.all end
[ "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def show\r\n @defense = Defense.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @defense }\r\n end\r\n end", "def index\n @defense_responses = DefenseResponse.all\n end", "def index\n @offenses = Offense.all\n end", "def index\n @api_v1_expenses = Api::V1::Expense.all\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def show\n @expenses = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenses }\n end\n end", "def index\n @fixed_expenses = FixedExpense.for_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fixed_expenses }\n end\n end", "def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end", "def index\n @lenses = Lense.all\n end", "def list\n @title = t(:message_3, :scope => [:controller, :defenses])\n @defenses = Defense.find_for(@user, :not_passed => true)\n end", "def index\n @expensescounters = Expensescounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expensescounters }\n end\n end", "def index\n @dog_expenses = DogExpense.all\n end", "def index\n @api_v1_initiative_expenses = Api::V1::InitiativeExpense.all\n end", "def index\n @expenses = Expense.limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expenses }\n end\n end", "def show\n @admin_expense = Admin::Expense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_expense }\n end\n end", "def index\n @exspenses = Exspense.all\n end", "def index\n @actual_expenses = ActualExpense.all\n end", "def index\n\n if params[:lense_type_selection].present?\n @lenses = Lense.search(params)\n else\n @lenses = Lense.all\n end\n @lense_types = LenseType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lenses }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /defenses POST /defenses.json
def create @defense = Defense.new(defense_params) respond_to do |format| if @defense.save format.html { redirect_to @defense, notice: 'Defense was successfully created.' } format.json { render :show, status: :created, location: @defense } else format.html { render :new } format.json { render json: @defense.errors, status: :unprocessable_entity } end end end
[ "def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def index\n @defenses = Defense.all\n end", "def post_expense(expense)\n post '/expenses', JSON.generate(expense)\n #check the post attempt was a success\n expect(last_response.status).to eq(200)\n\n #check the data is in JSON structure\n parsed = JSON.parse(last_response.body)\n\n #check the data includes an expense_id\n #passing a matcher into another = composing matchers\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n\n #add an id key to the hash\n expense.merge('id' => parsed['expense_id'])\n end", "def create\n @admin_expense = Admin::Expense.new(params[:admin_expense])\n\n respond_to do |format|\n if @admin_expense.save\n format.html { redirect_to admin_expenses_url }\n format.json { render json: @admin_expense, status: :created, location: @admin_expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @marketing_fixed_expense = MarketingFixedExpense.new(marketing_fixed_expense_params)\n\n respond_to do |format|\n if @marketing_fixed_expense.save\n format.html { redirect_to @marketing_fixed_expense, notice: 'Marketing fixed expense was successfully created.' }\n format.json { render :show, status: :created, location: @marketing_fixed_expense }\n else\n format.html { render :new }\n format.json { render json: @marketing_fixed_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_expense = Api::V1::Expense.new(api_v1_expense_params)\n\n respond_to do |format|\n if @api_v1_expense.save\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_expense }\n else\n format.html { render :new }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @defense_response = DefenseResponse.new(defense_response_params)\n\n respond_to do |format|\n if @defense_response.save\n format.html { redirect_to @defense_response, notice: 'Defense response was successfully created.' }\n format.json { render :show, status: :created, location: @defense_response }\n else\n format.html { render :new }\n format.json { render json: @defense_response.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lense = Lense.new(lense_params)\n\n respond_to do |format|\n if @lense.save\n format.html { redirect_to lenses_path, notice: 'Lense was successfully created.' }\n format.json { render :show, status: :created, location: @lense }\n else\n format.html { render :new }\n format.json { render json: @lense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @solideo_depense = SolideoDepense.new(solideo_depense_params)\n\n respond_to do |format|\n if @solideo_depense.save\n format.html { redirect_to solideo_depenses_path, notice: 'Solideo depense was successfully created.' }\n format.json { render :show, status: :created, location: @solideo_depense }\n else\n format.html { render :new }\n format.json { render json: @solideo_depense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dog_expense = DogExpense.new(dog_expense_params)\n\n respond_to do |format|\n if @dog_expense.save\n format.html { redirect_to @dog_expense, notice: 'Dog expense was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dog_expense }\n else\n format.html { render action: 'new' }\n format.json { render json: @dog_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estimated_expense = EstimatedExpense.new(estimated_expense_params)\n\n respond_to do |format|\n if @estimated_expense.save\n format.html { redirect_to @estimated_expense, notice: 'Estimated expense was successfully created.' }\n format.json { render :show, status: :created, location: @estimated_expense }\n else\n format.html { render :new }\n format.json { render json: @estimated_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_answer_expense = Api::V1::AnswerExpense.new(api_v1_answer_expense_params)\n\n respond_to do |format|\n if @api_v1_answer_expense.save\n format.html { redirect_to @api_v1_answer_expense, notice: 'Answer expense was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_answer_expense }\n else\n format.html { render :new }\n format.json { render json: @api_v1_answer_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\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 action: 'show', status: :created, location: @dispense }\n else\n format.html { render action: 'new' }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lense = Lense.new(params[:lense])\n\n respond_to do |format|\n if @lense.save\n format.html { redirect_to root_path, notice: 'Lense was successfully created.' }\n format.json { render json: @lense, status: :created, location: @lense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fuel_expense = FuelExpense.new(fuel_expense_params)\n\n respond_to do |format|\n if @fuel_expense.save\n format.html { redirect_to @fuel_expense, notice: 'Fuel expense was successfully created.' }\n format.json { render :show, status: :created, location: @fuel_expense }\n else\n format.html { render :new }\n format.json { render json: @fuel_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rec_expense = RecExpense.new(rec_expense_params)\n\n respond_to do |format|\n if @rec_expense.save\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully created.' }\n format.json { render :show, status: :created, location: @rec_expense }\n else\n format.html { render :new }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_initiative_expense = Api::V1::InitiativeExpense.new(api_v1_initiative_expense_params)\n\n respond_to do |format|\n if @api_v1_initiative_expense.save\n format.html { redirect_to @api_v1_initiative_expense, notice: 'Initiative expense was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_initiative_expense }\n else\n format.html { render :new }\n format.json { render json: @api_v1_initiative_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @record_expense = RecordExpense.new(record_expense_params)\n\n respond_to do |format|\n if @record_expense.save\n format.html { redirect_to @record_expense, notice: 'New expense successfully created.' }\n format.json { render :show, status: :created, location: @record_expense }\n else\n format.html { render :new }\n format.json { render json: @record_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adsense = Adsense.new(adsense_params)\n\n respond_to do |format|\n if @adsense.save\n format.html { redirect_to @adsense, notice: 'Adsense was successfully created.' }\n format.json { render :show, status: :created, location: @adsense }\n else\n format.html { render :new }\n format.json { render json: @adsense.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Closes the open remote shell session. This method can be called multiple times, even if there is no open session.
def close return if shell.nil? service.close_shell(shell) @shell = nil end
[ "def close\n @shell.close\n end", "def close\n @ssh.close\n end", "def close\n begin\n close_session\n rescue => e\n STDERR.puts \"Failed to send or receive close-session: #{e}\"\n ensure\n @connection.close\n end\n end", "def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end", "def close\n @channel.close if @channel\n @channel = nil\n @ssh.close if @close_all and @ssh\n end", "def shell_close()\n self.kill\n end", "def logout!\n @ssh.close\n @ssh = nil\n end", "def end_session!\n @socket = socket.close\n end", "def close\n session.close if session\n ensure\n master.server_closed(self) if session\n @session = nil\n end", "def close\n shell.close! if open?\n buffer.flush\n buffer.reset\n end", "def close\n if @sftp_session\n logger.debug(\"[SFTP] closing connection to #{self}\")\n begin\n sftp_session.close_channel\n rescue Net::SSH::Disconnect\n # Welp, we tried.\n rescue IOError\n # Can happen with net-ssh 4.x, no idea why.\n # See https://github.com/net-ssh/net-ssh/pull/493\n end\n end\n ensure\n @sftp_session = nil\n # Make sure we can turn down the session even if closing the channels\n # fails in the middle because of a remote disconnect.\n saved_session = @session\n begin\n super\n rescue Net::SSH::Disconnect\n # Boooo zlib warnings.\n saved_session.transport.close if saved_session\n end\n end", "def close()\n # If we don't have one we don't do anything\n return if !@is_scproxy or !self.has_session?\n\n # Send the call to the master\n response = self.proxy_close :port => @port, :master => true\n\n # Did we close it?\n if response[\"status\"] == true\n # Clear our session\n @port = nil\n else\n # Show an error\n raise response[\"message\"]\n end\n end", "def close_session\n end", "def shell_close(shell = nil)\n\t\traise NotImplementedError\n\tend", "def ssh_close(ssh)\n ssh.close\n if ssh.closed?\n $stdout.puts \"SSH connection closed\\n\\n\" if $VERBOSE\n end \n ssh = nil\n end", "def close_shell(shell = nil)\n\t\traise NotImplementedError\n\tend", "def close\n SLPClose(@handle)\n end", "def cmd_close_session argv\n setup argv\n response = @api.close_session\n msg response\n return response\n end", "def close_remote(port, host = \"127.0.0.1\") \r\n ensure_open! \r\n\r\n @session_mutex.synchronize do \r\n @session.forward.cancel_remote(port, host) \r\n end \r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens a remote shell session for reuse. The maxiumum commandpershell threshold is also determined the first time this method is invoked and cached for later invocations.
def open close @shell = service.open_shell @command_count = 0 determine_max_commands unless max_commands shell end
[ "def open\n close\n retryable(service.retry_limit, service.retry_delay) do\n @shell = service.open_shell(codepage: code_page)\n end\n add_finalizer(shell)\n @command_count = 0\n shell\n end", "def remote_shell(&block)\n RemoteShell.new(@dest,&block)\n end", "def create_shell\n host_address = Helper.winrm_address(@machine)\n host_port = Helper.winrm_port(@machine)\n\n WinRMShell.new(\n host_address,\n @machine.config.winrm.username,\n @machine.config.winrm.password,\n port: host_port,\n timeout_in_seconds: @machine.config.winrm.timeout,\n max_tries: @machine.config.winrm.max_tries,\n )\n end", "def request_shell\n @state = :shell\n @channel.send_request \"shell\", nil, true\n end", "def open_session(iter)\n Msf::Ui::Gtk2::Console::Shell.new(iter)\n end", "def open( options={} )\n pty_opts = options[:pty]\n\n @shell_factory.call( pty_opts )\n end", "def new_session #:nodoc:\n session = if gateway\n gateway.ssh(host, user, options)\n else\n Net::SSH.start(host, user, options)\n end\n\n session[:server] = self\n session\n rescue ::Timeout::Error => error\n raise Net::SSH::ConnectionTimeout.new(\"#{error.message} for #{host}\")\n rescue Net::SSH::AuthenticationFailed => error\n raise Net::SSH::AuthenticationFailed.new(\"#{error.message}@#{host}\")\n end", "def open\n ENV['SSH_ASKPASS'] = File.expand_path(File.join(File.dirname(__FILE__),\n '..', '..', '..',\n 'scripts',\n 'stub_ssh_askpass'))\n ENV['HOME'] = \"/dev/null\"\n @dir = Dir.mktmpdir\n @socketfile = File.join(@dir, \"agent\")\n @process = nil\n @interupted_to_close = false\n @ssh_agent_output = ::RightScale::RightPopen::SafeOutputBuffer.new\n cmd = ['ssh-agent', '-a', @socketfile, '-d']\n ::RightScale::RightPopen.popen3_sync(\n cmd,\n :target => self,\n :inherit_io => true, # avoid killing any rails connection\n :watch_handler => :watch_ssh_agent,\n :stderr_handler => :output_ssh_agent,\n :stdout_handler => :output_ssh_agent,\n :timeout_handler => :timeout_ssh_agent,\n :exit_handler => :exit_ssh_agent,\n :timeout_seconds => 10)\n if @process\n ENV['SSH_AGENT_PID'] = @process.pid.to_s\n ENV['SSH_AUTH_SOCK'] = @socketfile\n end\n end", "def rpc_shell_upgrade( sid, lhost, lport)\n s = _valid_session(sid,\"shell\")\n s.exploit_datastore['LHOST'] = lhost\n s.exploit_datastore['LPORT'] = lport\n s.execute_script('post/multi/manage/shell_to_meterpreter')\n { \"result\" => \"success\" }\n end", "def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end", "def create_shell\n winrm_info = Helper.winrm_info(@machine)\n\n WinRMShell.new(\n winrm_info[:host],\n winrm_info[:port],\n @machine.config.winrm\n )\n end", "def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n @current = Open3.popen3(self.shell_executable)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end", "def open_shell(channel, pty)\n pty.send_channel_request 'shell' do |_, success|\n if success\n logger.info '[tty] shell opened'\n set_write_callbacks channel\n end\n end\n end", "def open\n ENV['SSH_ASKPASS'] = File.expand_path(File.join(File.dirname(__FILE__),\n '..', '..', '..',\n 'scripts',\n 'stub_ssh_askpass'))\n ENV['HOME'] = \"/dev/null\"\n @dir = Dir.mktmpdir\n @socketfile = File.join(@dir, \"agent\")\n @monitor = ProcessWatcher::ProcessMonitor.new\n @pid = @monitor.spawn('ssh-agent', '-a', @socketfile, '-d') {}\n timeout = 0\n until File.exists?(@socketfile)\n timeout += 1\n sleep 0.1\n if timeout > 100\n raise \"Couldn't find SSH agent control socket in time. Timing out\"\n end\n end\n ENV['SSH_AGENT_PID'] = @pid.to_s\n ENV['SSH_AUTH_SOCK'] = @socketfile\n end", "def new_session\n # disable autocorrect (oh-my-zsh)\n shell_write(\"unsetopt correct_all; unsetopt correct\\n\")\n # fixing oh-my-zsh themes\n shell_write(\"PROMPT='$ '\\n\")\n # fixing issues with ZSH syntax highlighting (not very common)\n shell_write(\"unset ZSH_HIGHLIGHT_HIGHLIGHTERS\\n\")\n # fixing issues with exotic ZSH prompts\n shell_write(\"prompt off\\n\")\n ###\n\n # disable bash completetion\n shell_write(\"complete -r\\n\")\n # enter\n shell_write(\"\\n\")\n # second enter\n shell_write(\"\\n\")\n #############\n # new_session_start\n rstream.flush\n end", "def init_ssh_session\n @ssh_session.close if !(@ssh_session.nil? or !@ssh_session.closed?)\n ssh_opts = ssh_connection_options\n @log.info(\"Opening ssh connection to #{ssh_opts[:host]} as user #{ssh_opts[:user]}\")\n @ssh_session = ::Net::SSH.start(ssh_opts[:host], ssh_opts[:user])\n return @ssh_session\n end", "def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n Chef::Log.debug(\"RVM::Shell::ChefWrapper subprocess executing with \" +\n \"environment of: [#{shell_params.inspect}].\")\n @current = popen4(self.shell_executable, shell_params)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end", "def local_shell(&block)\n LocalShell.new(&block)\n end", "def create_ssh_session\r\r\r\r\r\r\r\r\n Net::SSH.start(JUMPSRV, JUMPSRV_USER, password: JUMPSRV_PW, timeout: 30) # verbose: :info,\r\r\r\r\r\r\r\r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the safe maximum number of commands that can be executed on a remote shell session by interrogating the remote host.
def determine_max_commands os_version = run_powershell_script(PS1_OS_VERSION).stdout.chomp @max_commands = os_version < "6.2" ? LEGACY_LIMIT : MODERN_LIMIT @max_commands -= 2 # to be safe end
[ "def max_command_length\n @max_command_length ||=\n if Gem.win_platform?\n # Windows is limited to 2048 since that is a worst-case scenario.\n # http://blogs.msdn.com/b/oldnewthing/archive/2003/12/10/56028.aspx\n 2048\n else\n # We fudge factor this by halving the buffer size since *nix systems\n # usually have pretty large limits, and the actual limit changes\n # depending on how much of your stack is environment variables.\n # Definitely erring on the side of overly cautious.\n `getconf ARG_MAX`.to_i / 2\n end\n end", "def max_command_length; end", "def remote_maximum_packet_size; end", "def _unix_max_line_length\n # Based on autoconf's arg_max calculator, see\n # http://www.in-ulm.de/~mascheck/various/argmax/autoconf_check.html\n calc_line_max = 'i=0 max= new= str=abcd; \\\n while (test \"X\"`echo \"X$str\" 2>/dev/null` = \"XX$str\") >/dev/null 2>&1 && \\\n new=`expr \"X$str\" : \".*\" 2>&1` && \\\n test \"$i\" != 17 && \\\n max=$new; do \\\n i=`expr $i + 1`; str=$str$str;\\\n done; echo $max'\n line_max = session.shell_command_token(calc_line_max).to_i\n\n # Fall back to a conservative 4k which should work on even the most\n # restrictive of embedded shells.\n line_max = (line_max == 0 ? 4096 : line_max)\n vprint_status(\"Max line length is #{line_max}\")\n\n line_max\n end", "def _unix_max_line_length\n return @shell_max_line_length if @shell_max_line_length\n # Based on autoconf's arg_max calculator, see\n # http://www.in-ulm.de/~mascheck/various/argmax/autoconf_check.html\n calc_line_max = 'i=0 max= new= str=abcd; \\\n while (test \"X\"`echo \"X$str\" 2>/dev/null` = \"XX$str\") >/dev/null 2>&1 && \\\n new=`expr \"X$str\" : \".*\" 2>&1` && \\\n test \"$i\" != 17 && \\\n max=$new; do \\\n i=`expr $i + 1`; str=$str$str;\\\n done; echo $max'\n line_max = session.shell_command_token(calc_line_max).to_i\n\n # Fline_maxall back to a conservative 4k which should work on even the most\n # restrictive of embedded shells.\n line_max = (line_max == 0 ? 4096 : line_max)\n #######################################\n # maximal stable length seems to be 12288\n # TODO: more testing\n # stable_max = 12288\n stable_max = 4096\n if line_max > stable_max\n line_max = stable_max\n end\n # if line_max > 60000\n # puts \"adding security buffer\"\n # # adding a buffer\n # # otherwise it cases sometimes errors\n # # TODO: finding a stable and fast number for this buffer\n # line_max = line_max / 50\n # end\n # line_max = 4000 # TESTING\n vprint_status(\"Max line length is #{line_max}\")\n @shell_max_line_length = line_max\n line_max\n end", "def max_allowed_packet # :nodoc:\n @max_allowed_packet ||= begin\n result = execute( \"SELECT @@max_allowed_packet\" )\n # original Mysql gem responds to #fetch_row while Mysql2 responds to #first\n val = result.respond_to?(:fetch_row) ? result.fetch_row[0] : result.first[0]\n val.to_i\n end\n end", "def largest_length\n @executor.getLargestPoolSize\n end", "def max_children(host)\n max = @host_status[\"#{host}:max_children\"].to_i\n max == 0 ? nil : max # if Max isn't set its not running\n end", "def cmdMaxDepth\n depth=0\n @commands.sort.each do |name,cmd|\n levels = name.split\n depth = levels.count if levels.count > depth\n end\n depth\n end", "def length\n @commands.length\n end", "def check_cmd remote_port\n \"ssh #{user_at_host} -p #{@port} \\\"netstat -ano | grep :#{remote_port} | wc -l\\\"\"\n end", "def number_of_remote_servers\n connection.servers.inject(0) do |sum, s|\n sum += 1 if server_is_proxy_type?(s) \n sum\n end\n end", "def max_size\n @pool.limit\n end", "def get_channel_max_users\n # Suppress stderr as Quanta kit barfs after the first undefined user\n Integer(/Maximum User IDs\\s*:\\s*(\\d+)/.match(%x{ipmitool channel getaccess #{@channel} 2> /dev/null})[1])\n end", "def maxJobN()\n _jobN = 0 ;\n eachHost(){|_host|\n _jobN += _host.max_num_jobs ;\n }\n return _jobN ;\n end", "def ulimit_check\n @servers.each do |server|\n result = server.spot_check_command(\"su - mysql -s /bin/bash -c \\\"ulimit -n\\\"\")\n raise \"FATAL: ulimit wasn't set correctly\" unless result[:output].to_i >= 1024\n end\n end", "def run_limit(credentials = nil)\n read(links[:runlimit], \"text/plain\", credentials).to_i\n end", "def ceph_pool_size(requested_size)\n # Assume default CRUSH replication policy of host\n num_storagenodes = search(:node, 'roles:storagenode').length\n [[requested_size, num_storagenodes].min, 1].max\nend", "def hosts_count\r\n return @hosts.length\r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /families/new GET /families/new.json
def new @family = Family.new respond_to do |format| format.html # new.html.erb format.json { render json: @family } end end
[ "def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @family }\n end\n end", "def new\n @family_type = FamilyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_type }\n end\n end", "def new\n if params[:family_id]\n @family = Family.find(params[:family_id])\n else\n @family = nil\n end\n @fish = Fish.new\n @fish.family = @family\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish }\n end\n end", "def new\n @family_group = FamilyGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_group }\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_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 new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end", "def new\n @medium_family = MediumFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_family }\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 @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end", "def new\n @breadcrumb = 'create'\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_family }\n end\n end", "def new\n @child = @family.children.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @child }\n end\n end", "def new\n @product_family = ProductFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_family }\n end\n end", "def new\n @familysearch_account = FamilysearchAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familysearch_account }\n end\n end", "def new\n @founder = Founder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @founder }\n end\n end", "def new\n @father = Father.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @father }\n end\n end", "def create\n @family = Family.new(params[:family])\n\n respond_to do |format|\n if @family.save\n format.html { redirect_to @family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @family, :status => :created, :location => @control_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 new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @control_family = ControlFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @control_family }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lazy read the contact information
def contact @contact ||= get_contact(@data_object.user_contact) end
[ "def read_other_details\n # Get Contact information\n @base_xml.elements.each(\"#{@ns}:Contacts/#{@ns}:Contact\") do |contact|\n @contacts << BuildingSync::Contact.new(contact, @ns)\n end\n end", "def contact\n response[\"contact\"]\n end", "def display_one_contact\n contact = retrieve_contact_by_email\n end", "def fetch\n RubyRedtail::Query.run(\"contacts/#{contact_id}/addresses\", @api_hash, \"GET\")\n end", "def get_contact\n if self.contact_id\n return self.contact\n end\n end", "def fetch\n if @auth != nil\n http = Net::HTTP.new('www.google.com', 80)\n path = \"/m8/feeds/contacts/default/base?max-results=10000\"\n headers = {'Authorization' => \"GoogleLogin auth=#{@auth}\"}\n resp, data = http.get(path, headers)\n \n xml = REXML::Document.new(data)\n contacts = []\n xml.elements.each('//entry') do |entry|\n person = {}\n person['name'] = entry.elements['title'].text\n \n gd_email = entry.elements['gd:email']\n person['email'] = gd_email.attributes['address'] if gd_email\n\n entry.each_element('gd:phoneNumber') { |gd_phonenumber|\n if gd_phonenumber\n if person['phoneNumber'] == nil\n person['phoneNumber'] = []\n end\n person['phoneNumber'] << gd_phonenumber.text\n end\n }\n contacts << person\n end\n return contacts\n end\n return []\n end", "def scrape_contacts\n unless agent.cookies.find{|c| c.name == 'MSPPre' && c.value == options[:username]}\n raise( Blackbook::BadCredentialsError, \"Must be authenticated to access contacts.\" )\n end\n\n page = agent.get('PrintShell.aspx?type=contact')\n rows = page.search(\"//div[@class='ContactsPrintPane cPrintContact BorderTop']\")\n rows.collect do |row|\n vals = {}\n row.search(\"table/tr\").each do |pair|\n key = pair.search(\"td[@class='TextAlignRight Label']\").first.inner_text.strip rescue nil\n next if key.nil?\n val = pair.search(\"td[@class='Value']\").first.inner_text.strip\n vals[key.to_sym] = val\n end\n vals[:name] = vals['Name:'.to_sym] rescue ''\n vals[:email] = (vals['Personal e-mail:'.to_sym] || vals['Work e-mail:'.to_sym] || vals['Windows Live ID:'.to_sym]).split(' ').first rescue ''\n vals\n end\n end", "def get_contact\n businessdocument&.contact\n end", "def get_company_info_from_fullcontact\n response = HTTParty.get(FULLCONTACT_LOOKUP_API, query: { \"domain\" => fetched_domain,\n \"apiKey\" => FULLCONTACT_API_KEY })\n response = response.success? ? JSON(response.body) : raise(\"Could not get information from FullContact, check rate limit.\")\n raise \"FullContact retry error\" if response[\"status\"] == 202 # FullContact queues for search sometimes.\n response\n end", "def contact_info(handle)\n response = query_no_raise :query_whois, contact: handle\n case response[:headers][:status_code]\n when '2303' then nil\n when '0' then\n result = {}\n response[:body].split(\"\\n\").each do |line|\n line.slice! /^contact\\./\n line_parsed = parse_line(line)\n next if line_parsed.is_a? String\n key, value = line_parsed.first\n case key\n when :name then next if value == \"- -\"\n when :address_1, :address_2, :address_3 then\n result[:address] = [] unless result.has_key? :address\n result[:address] << value\n when :state then next if value == \"--\"\n when :organization then next if value == \"-\" or value.empty?\n when :created_date, :modified_date then\n result[key] = DateTime.parse value\n else\n result.merge! line_parsed\n end\n end\n result\n else\n raise_response response\n end\n end", "def contact\n contact_property ? contact_property.ruby_value : nil\n end", "def contact_address\n details? ? details[\"Contact\"][\"address1\"] : ''\n end", "def contact_details_for(contact)\n if contact.title.present? && contact.department.present?\n return contact_title_and_department_for(contact)\n end\n return contact_title_for(contact) if contact.title.present?\n return contact_department_for(contact) if contact.department.present?\n end", "def inportant_information\n RubyRedtail::Query.run(\"contacts/#{self.contact_id}/importantinfo\", @api_hash, \"GET\")\n end", "def contact\n find('Contact', contact_id)\n end", "def get_event_contact\n if contact_information.present?\n contact_information\n else\n account.event_contact\n end\n end", "def load_contacts\n Contact.all.map{|u| [ u.contact_name, u.contact_name ]}\n end", "def retrieve_contact_by_email\n unless @rolodex.is_empty?\n print \"Please, provide the email of the contact in question: \"\n contact = @rolodex.search_contact(gets.chomp)\n if contact\n @rolodex.display_particular(contact)\n else\n puts \"Error: contact not found.\"\n end\n else\n contact = false\n puts \"Error: the Rolodex is empty.\"\n end\n return contact\n end", "def get_contact\r\n @contact = @customer.contact_people.find_by_name params[:id]\r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
put this user's stuff into a hash
def add_to_hash(hash) super contact.add_to_hash(hash) hash['user_over_13'] = @user_over_13 || !@new_user hash['last_logged_in'] = fmt_date_time(@data_object.user_last_logged_in) hash['first_logged_in'] = fmt_date_time(@data_object.user_first_logged_in) # aff_opts = Affiliate.options hash end
[ "def auth_hash\n\n hash = user_data(@access_token)\n puts \"got final hash with user info:\"\n pp hash\n\n # Preparing hash as per OmniAuth convention and returning to caller\n OmniAuth::Utils.deep_merge(\n super, {\n 'uid' => hash['orcid'], # The unique contributor identifier\n 'user_info' => hash, # ORCID profile data, including protected fields\n }\n )\n end", "def merge_user!(hash, user, prefix=nil)\n case user\n when Integer\n hash[[prefix, \"user_id\"].compact.join(\"_\").to_sym] = user\n when String\n if user[URI_SUBSTRING]\n hash[[prefix, \"screen_name\"].compact.join(\"_\").to_sym] = user.split(\"/\").last\n else\n hash[[prefix, \"screen_name\"].compact.join(\"_\").to_sym] = user\n end\n when ::URI\n hash[[prefix, \"screen_name\"].compact.join(\"_\").to_sym] = user.path.split(\"/\").last\n when Twitter::User\n hash[[prefix, \"user_id\"].compact.join(\"_\").to_sym] = user.id\n end\n hash\n end", "def get_hash\n\t\tuser_list = {}\n\t\tuser_count = 0\n\t\t@user_ids.each do |user_id|\n\t\t\tbegin\n\t\t\t\tuser = User.find(user_id)\n\t\t\trescue ActiveRecord::RecordNotFound\n\t\t\t\tnext\n\t\t\tend\n\t\t\tuser_count += 1\n\t\t\tuser_list[user_count] = { name: user.name, email: user.email }\n\t\tend\n\t\tuser_list[:user_count] = user_count\n\t\treturn { cond_type: @cond_type, cond_met: @cond_met, user_list: user_list, id_list: @user_ids }\n\tend", "def current_user_hash=(user)\n @current_user_hash = user\n end", "def set_students_hash_map\n connect_db\n load_users = $dbcon.query('SELECT * FROM users')\n #clear hah and update data to student hash map from db\n USERS_HASH_MAP.clear\n load_users.each do |user|\n USERS_HASH_MAP[user['email']] = User.new(user['name'], user['email'], user['passwd'], user['hintID'], user['hintAnswer'])\n end\nend", "def import_uh\n # user hash : tw_user -> bl_user\n @uh = Hash.new\n open(\"userlist.db\").read.split(\"\\n\").each do |line|\n ary = line.split(\" \")\n @uh[ ary[1] ] = ary[0]\n end\n puts \"userlist.db is imported. (#{@uh.size} users)\"\n end", "def setup_user_tips_hash\n @user_tips_hash = Hash.new\n if current_user\n @user_tips = Tip.where(\"user_id = ?\", current_user.id)\n @user_tips.each {|t| @user_tips_hash[t.game_id] = t } \n end\n end", "def set_urs_user_hash(proposals)\n submitters = proposals.map { |proposal| proposal['submitter_id'] }.uniq\n urs_users = retrieve_urs_users(submitters)\n @urs_user_hash = {}\n urs_users.each do |user|\n @urs_user_hash[user['uid']] = \"#{user['first_name']} #{user['last_name']}\"\n end\n end", "def username_hash\n @username_hash ||= \\\n begin\n hsh = {}\n find_usernames(:owner_id=>data._id).map { |un| \n hsh[un['_id']] = un['username']\n }\n hsh\n end\n end", "def save\n REDIS.set @user.delete(:key), @user.to_json\n @user # NOTE: SET can't fail (http://redis.io/commands/set)\n end", "def get_hash\n\t\treturn { name: self.name, email: self.email }\n\tend", "def user_store_key(key)\n 'user-' << Digest::MD5.hexdigest(key.gsub(/\\/.*$/, ''))\n end", "def load_user_info\n\t\tif @user_info.has_key?(@@line_array[0].to_i)\n\t\t\t@user_info[@@line_array[0].to_i][@@line_array[1].to_i] = @@line_array[2].to_i\n\t\telse\n\t\t\t@user_info[@@line_array[0].to_i] = {@@line_array[1].to_i => @@line_array[2].to_i}\n\t\tend\n\tend", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def initialize(user, name)\n @user = user\n @name = name\n @@all << self\n self.add_to_user_key(user)\n Stash.all_hash_cellar_key[self] = []\n end", "def hash\n data = [store.id, user.id, timestamp].join('$')\n Base64.encode64(OpenSSL::HMAC.digest('SHA256', store.private_key, data)).chomp\n end", "def save_user(username)\n $redis.rpush @@lobby_users, connection.id\n $redis.hset \"user:#{connection.id}\", \"username\", username\n end", "def create(user_info)\n\n # user hash varaible to hold the hash of the newly created user\n user_hash = {}\n\n # column array for the table\n key_array = %w{firstname lastname age password email}\n\n # creating the new user info to be assigned to the user hash\n user_info.each_with_index do |info, index|\n index == 2? @user[key_array[index]] = info.to_i : @user[key_array[index]] = info.strip\n end\n\n # creates a of id => user_info\n user_hash[@id] = @user\n\n # hold the current saved user ID\n user_id = @id\n\n # save/write the user hash to file\n File.write(Dir.pwd+\"/\"+@file, user_hash.to_s+\"\\n\", mode: 'a')\n # File.write('C:\\Users\\praise.wisdom\\Documents\\db.raw', user_hash.to_s+\"\\n\")\n\n # increment the current instance variable ID\n @id += 1\n\n # return the current saved user ID\n user_id\n end", "def merge_user(hash, user, prefix=nil)\n merge_user!(hash.dup, user, prefix)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
log to the UserHistory table
def log(notes) @uh_log ||= UserHistory.new @uh_log.log(self, notes) end
[ "def history\n\t\t@user.show_log\n\tend", "def insert_to_history(order)\n @user_history << order\n @user_history\n end", "def index\n @user = User.find(current_user.id)\n @history_logs = @user.history_logs\n end", "def record_work_edit_history(work, user)\n history = work.histories.create()\n history.user = user\n history.save\n end", "def add_to_log\n user_name = self.user.name || self.user.email.split('@')[0]\n Log.create!(loggingtype: 2,user_id_1: self.user.id ,user_id_2: nil,admin_id: nil,story_id: nil ,interest_id: nil,message: (user_name+\" added a Facebook account\").to_s)\n end", "def record_history\n history_user_absent_action if history_user_id.nil?\n\n attrs = attributes.clone\n history_class = self.class.history_class\n foreign_key = history_class.history_foreign_key\n\n now = UTC.now\n attrs.merge!(foreign_key => attrs['id'], history_started_at: now, history_user_id: history_user_id)\n\n attrs = attrs.except('id')\n\n current_history = histories.where(history_ended_at: nil).order('id desc').limit(1).last\n\n if foreign_key.present? && history_class.present?\n history_class.create!(attrs)\n current_history.update!(history_ended_at: now) if current_history.present?\n else\n raise 'Need foreign key and history class to save history!'\n end\n end", "def save_activity_log(activity_log)\n activity_log.user = self\n activity_log.save\n end", "def update_user_activity_history\n user.activity_histories << OnlineLearningHistory.new(name: name+\"#completed\")\n end", "def history_create\n # history_log('created', created_by_id)\n end", "def log_user_activity!\n \n # clone in way which strips out attachments\n params_to_log = collect_hash_contents(params)\n\n params_to_log.delete('controller') \n params_to_log.delete('action') \n \n log_entry = LogEntry.create!( :user_id => current_user.id, :action => params[:controller]+'.'+params[:action], :params => params_to_log, :referrer => request.env[\"HTTP_REFERER\"], :user_agent => request.env[\"HTTP_USER_AGENT\"], :host => request.env[\"REMOTE_ADDR\"] );\n \n end", "def write_history; end", "def index\n @user_history_details = UserHistoryDetail.all\n end", "def go_to_history_table_page\n\t \thead_history.hover\n\t \thead_table.click\n\t end", "def save_to_history (comments, changed_by_user_id)\n user_account_change = UserAccountChange.new({\n # Copy the user_account information\n :first_name => self.first_name,\n :last_name => self.last_name,\n :account_status_id => self.account_status_id,\n :home_phone => self.home_phone,\n :work_phone => self.work_phone,\n :mobile_phone => self.mobile_phone,\n :user_account_id => self.id,\n :email => self.email,\n # Add audit information\n :change_comments => comments,\n :changed_by_user_account_id => changed_by_user_id\n })\n user_account_change.save()\n end", "def login_user_by_id(user_id)\r\n session[:user_id] = user_id\r\n logger.debug(\"Setting session id to #{session[:user_id]}\")\r\n AuditLog.create(:user_id => user_id, :action => \"Logged in\")\r\n end", "def log_activity\n current_user.log_activity(Time.now.utc) if current_user\n end", "def history\n @history ||= @repository.log(30, nil, path)\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def set_work_history\n @work_history = WorkHistory.find_by(id: params[:id], user_id: current_user)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lazy load an affiliate
def affiliate @affiliate || Affiliate.with_id(@data_object.user_affiliate) end
[ "def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end", "def set_affiliate\n if affiliate.present?\n account.affiliate_id = affiliate.id\n account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil\n else\n account.affiliate_id = account.affiliate_other = nil\n end\n account\n end", "def get_affiliate_user\n user = User.where(affiliate_tag: cookies.signed[:zid]).first if cookies.signed[:zid]\n if user && user.access_affiliate\n user\n else\n cookies.delete :zid\n nil\n end\n end", "def show\n @user = current_user\n @affiliate = current_user.affiliate\n end", "def get_affiliate_user\n User.where(affiliate_tag: cookies.signed[:zid]).first\n end", "def get_affiliations\n affiliations\n end", "def affiliate_class\n self.class.affiliate_class\n end", "def claim_affiliate\n # Claim affiliate\n raise if !self.is_first_store_purchase?\n raise if AffiliateClaimStore.where(store_purchase: self).present?\n\n # Find owner referred by\n affiliate = self.try(:owner).try(:affiliate_referred_by).try(:affiliate)\n raise if affiliate.blank?\n\n # Find affiliate publisher\n publisher = affiliate.publisher\n\n # Hitung commission berdasarkan berapa banyak publisher telah menghasilkan\n # store_purchase yang berhasil di close (bayar)\n aff_success = publisher.affiliate_referring(type: \"store\", status: \"success\")\n if aff_success.count < 10\n commission = AffiliateCommissionStore.find_by(quantity: 0)\n elsif aff_success.count >= 10\n commission = AffiliateCommissionStore.find_by(quantity: 10)\n end\n\n # Create AffiliateClaim record\n # Commission akan diberikan ketika store_purchase statusnya closed\n AffiliateClaimStore.create(affiliate: affiliate, store_purchase: self, commission: commission)\n\n rescue\n nil\n end", "def current_affiliate_id\n @current_affiliate_id ||= set_affiliate_id\n end", "def claim_affiliate\n # Claim affiliate\n raise if !self.is_first_contest?\n raise if AffiliateClaimContest.where(contest: self).present?\n\n # Find owner referred by\n affiliate = self.try(:owner).try(:affiliate_referred_by).try(:affiliate)\n raise if affiliate.blank?\n\n # Find affiliate publisher\n publisher = affiliate.publisher\n\n # Hitung commission berdasarkan berapa banyak publisher telah menghasilkan\n # contest yang berhasil di close (bayar)\n aff_success = publisher.affiliate_referring(type: \"contest\", status: \"success\")\n if aff_success.count < 10\n commission = AffiliateCommissionContest.find_by(quantity: 0)\n elsif aff_success.count >= 10\n commission = AffiliateCommissionContest.find_by(quantity: 10)\n end\n\n # Create AffiliateClaim record\n # Commission akan diberikan ketika contest statusnya closed\n AffiliateClaimContest.create(affiliate: affiliate, contest: self, commission: commission)\n\n rescue\n nil\n end", "def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end", "def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end", "def payments_for_affiliate\n @title = \"Payments made to #{@affiliate.name}\"\n @payments = @affiliate.payments.find(:all, :order => \"id DESC\")\n end", "def affiliate= affiliate\n if affiliate\n if affiliate.class != affiliate_class # self.class.to_s != \"#{affiliate.class.to_s}Reference\"\n raise \"Attempt to affiliate #{self.class.to_s} reference with #{affiliate.class} object.\"\n elsif affiliate_id && (affiliate_id != affiliate.id)\n raise \"Attempt to create ambiguous reference by asserting new affiliate\"\n else\n self.affiliate_id = affiliate.id\n end\n end\n end", "def set_affiliate_id_from_session\n self.current_affiliate_id = session[:affiliate_id] unless session[:affiliate_id].blank?\n end", "def associated_with_affiliate?(aff_id)\n (aff_id == @data_object.user_affiliate) ||\n role_assoc_with_affiliate?(aff_id)\n end", "def affiliations\n aff = pubsub.find_first('ns:affiliations', :ns => self.class.registered_ns)\n unless aff\n self.pubsub << (aff = XMPPNode.new('affiliations', self.document))\n end\n aff\n end", "def all_affiliations\n @team_affiliations ||= TeamAffiliation.all\n end", "def new\n @user = User.new\n @user.build_affiliate\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
record the fact that this user is registered in an affiliate
def register_affiliate_role Role.set_user_role(@data_object.user_id, user_affiliate, nil, RoleNameTable::REGISTERED, TargetTable::AFFILIATE, user_affiliate) end
[ "def affiliate\n @affiliate || Affiliate.with_id(@data_object.user_affiliate)\n end", "def set_affiliate\n if affiliate.present?\n account.affiliate_id = affiliate.id\n account.affiliate_other = affiliate.subaffiliates_enabled? ? account_params[:affiliate_other] : nil\n else\n account.affiliate_id = account.affiliate_other = nil\n end\n account\n end", "def affiliate_visiting?\n has_affiliation? 'AFFILIATE-TYPE-VISITING'\n end", "def new\n @user = User.new\n @user.build_affiliate\n end", "def show\n @user = current_user\n @affiliate = current_user.affiliate\n end", "def claim_affiliate\n # Claim affiliate\n raise if !self.is_first_store_purchase?\n raise if AffiliateClaimStore.where(store_purchase: self).present?\n\n # Find owner referred by\n affiliate = self.try(:owner).try(:affiliate_referred_by).try(:affiliate)\n raise if affiliate.blank?\n\n # Find affiliate publisher\n publisher = affiliate.publisher\n\n # Hitung commission berdasarkan berapa banyak publisher telah menghasilkan\n # store_purchase yang berhasil di close (bayar)\n aff_success = publisher.affiliate_referring(type: \"store\", status: \"success\")\n if aff_success.count < 10\n commission = AffiliateCommissionStore.find_by(quantity: 0)\n elsif aff_success.count >= 10\n commission = AffiliateCommissionStore.find_by(quantity: 10)\n end\n\n # Create AffiliateClaim record\n # Commission akan diberikan ketika store_purchase statusnya closed\n AffiliateClaimStore.create(affiliate: affiliate, store_purchase: self, commission: commission)\n\n rescue\n nil\n end", "def associated_with_affiliate?(aff_id)\n (aff_id == @data_object.user_affiliate) ||\n role_assoc_with_affiliate?(aff_id)\n end", "def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end", "def has_affiliation?(affiliation)\n affiliations.include?(affiliation.upcase)\n end", "def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end", "def claim_affiliate\n # Claim affiliate\n raise if !self.is_first_contest?\n raise if AffiliateClaimContest.where(contest: self).present?\n\n # Find owner referred by\n affiliate = self.try(:owner).try(:affiliate_referred_by).try(:affiliate)\n raise if affiliate.blank?\n\n # Find affiliate publisher\n publisher = affiliate.publisher\n\n # Hitung commission berdasarkan berapa banyak publisher telah menghasilkan\n # contest yang berhasil di close (bayar)\n aff_success = publisher.affiliate_referring(type: \"contest\", status: \"success\")\n if aff_success.count < 10\n commission = AffiliateCommissionContest.find_by(quantity: 0)\n elsif aff_success.count >= 10\n commission = AffiliateCommissionContest.find_by(quantity: 10)\n end\n\n # Create AffiliateClaim record\n # Commission akan diberikan ketika contest statusnya closed\n AffiliateClaimContest.create(affiliate: affiliate, contest: self, commission: commission)\n\n rescue\n nil\n end", "def affiliation=(affil)\n affiliations.clear\n affiliations << affil\n end", "def affiliate?\n role == 'affiliate'\n end", "def current_affiliate_id\n @current_affiliate_id ||= set_affiliate_id\n end", "def set_affiliate_id_from_session\n self.current_affiliate_id = session[:affiliate_id] unless session[:affiliate_id].blank?\n end", "def affiliated?\n !affiliations.empty?\n end", "def get_affiliate_user\n user = User.where(affiliate_tag: cookies.signed[:zid]).first if cookies.signed[:zid]\n if user && user.access_affiliate\n user\n else\n cookies.delete :zid\n nil\n end\n end", "def set_affiliate_id\n set_affiliate_id_from_params || set_affiliate_id_from_session\n end", "def create\n @affiliate = Affiliate.new(affiliate_params)\n\n respond_to do |format|\n if @affiliate.save\n format.html { redirect_to @affiliate, notice: 'Affiliate was successfully created.' }\n format.json { render :show, status: :created, location: @affiliate }\n else\n format.html { render :new }\n format.json { render json: @affiliate.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Affiliate stuff. A user has one primary and any number of secondary affiliates. Is this user associated with the given affiliate?
def associated_with_affiliate?(aff_id) (aff_id == @data_object.user_affiliate) || role_assoc_with_affiliate?(aff_id) end
[ "def affiliate?\n role == 'affiliate'\n end", "def has_affiliation?(affiliation)\n affiliations.include?(affiliation.upcase)\n end", "def affiliated?\n !affiliations.empty?\n end", "def affiliate_visiting?\n has_affiliation? 'AFFILIATE-TYPE-VISITING'\n end", "def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end", "def advised?\n advisor_company_affiliations.with_access.present?\n end", "def user_authorized?(auth_org_code, affiliation)\n expected_affliation = \"member@#{auth_org_code}.edu\"\n affiliation.split(';').any? { |a| a.downcase == expected_affliation }\n end", "def affiliate\n @affiliate || Affiliate.with_id(@data_object.user_affiliate)\n end", "def affiliate_link?\n !current_user.try(:admin?)\n end", "def affiliates_enabled?\n affiliate_account_types.present?\n end", "def accountant? (house)\n user_house_links.each do |user_house_link|\n return true if !user_house_link.house.nil? && user_house_link.house.id == house.id &&\n user_house_link.accountant?\n end\n return false\n end", "def auth_user_association_matches?(assoc,user)\n return self.send(assoc) == user\n end", "def auth_user_association_matches?(assoc,user)\n self.send(assoc) == user\n end", "def has_affiliation_of_type?(affiliation_type)\n aff_type_string = affiliation_type.to_s.upcase\n affiliations.find { |a| a =~ /^#{aff_type_string}-TYPE-/ } ? true : false\n end", "def affiliations(kind)\n profile['affiliations'][kind] || false\n end", "def iine?(user)\n iine_users.include?(user)\n end", "def staff?\n affiliations 'capStaff'\n end", "def center_has_member?(user)\r\n self.center.all_users.include? user\r\n end", "def own?\r\n @user.id == @record.user_id\r\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renvoie un tableau de cases contenant les erreurs qu'il y a dans la grille (lorsque la case est VIDE, ce n'est pas une erreur)
def casesIncorrect newStatutVide = StatutVide.new(VIDE) newStatutArbre = StatutArbre.new(ARBRE) tabCasesErr = Array.new grille=@grille.grille for i in 0..grille.length-1 for j in 0..grille.length-1 tabCasesErr.unshift(grille[i][j]) if (grille[i][j].statutVisible != grille[i][j].statut && grille[i][j].statutVisible != newStatutVide && grille[i][j].statut != newStatutArbre) end end return tabCasesErr.empty? ? 0 : tabCasesErr end
[ "def verifErreur()\n self.grille.grille.each{ |ligne|\n ligne.each{ |cases|\n if !self.verifCase(cases) \n @erreur += 1\n @locErreur.push([cases.ligne,cases.colonne])\n end\n }\n }\n end", "def valider_cours(cours, les_cours)\n erreur \"Sigle de motif incorect.\" unless cours.sigle =~ Motifs::SIGLE\n erreur \"Un cours avec le meme sigle existe deja.\" if les_cours.include? cours\n cours.prealables.each { |pre|\n erreur \"Prealable invalide car Sigle incorrect.\" unless Motifs::SIGLE =~ pre\n erreur \"Prealable invalide car inexistant ou inactif: #{pre}\" unless les_cours.any? { |cours| cours.sigle == pre && cours.actif? }\n }\n cours\nend", "def donnerErreur()\n return @grilleEnCours.firstDifference(@grilleBase)\n end", "def retourAvant()#TOTEST\n if(@indiceCoup < tabCoup.size) #vérification normalement inutile puisque le bouton devrait être disable\n #On annule en passant au coup suivant\n coupSuivant = tabCoup.at(@indiceCoup)\n @grilleEnCours.tabCases[coupSuivant.case.positionY][coupSuivant.case.positionX].couleur = coupSuivant.couleur\n @grilleRaz = nil\n\n @indiceCoup += 1 #On passe au coup suivant\n\n socket = Fenetre1v1.getSocket\n if(socket != nil)\n socket.puts (\"av\" + @grilleEnCours.getPourcentage(@grilleBase, nil).to_s )\n end\n end\n\n return [peutRetourAvant?, coupSuivant.case] #Pour dire aux fonctions appelantes si on peut encore aller en avant\n end", "def auMoinsUnVoisinDispoUnLienRestant(tabLien)\r\n for i in 0..3 do\r\n if(@tabTriangle[i]==true && @tabVoisins[i].etiquetteCase.to_i - 1 ==@tabVoisins[i].nbLienCase(tabLien) && @tabVoisins[i].nbVoisinsDispo()==1 )\r\n return true\r\n end\r\n end\r\n return false\r\n end", "def traiterrange(num, range)\r\n\r\n\t\ttab1 = premiere_possibilite(num, range)\r\n\t\ttab2 = deuxieme_possibilite(num, range)\r\n\r\n\t\ttaille = range.eql?(\"column\") ? @lines.size() : @clns.size()\r\n\r\n\t\t# Coloriage des cases sûres (intersection des 2 possibilités)\r\n\t\t(0...taille).each do |i|\r\n\t\t\tif tab1[i]==tab2[i] && tab1[i]>0\r\n\t\t\t\tset_grid(num, i, 1, range)\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\textremite(num, range)\r\n\tend", "def validacao(linhas_uteis)\r\n matricula_doc = linhas_uteis[0][-1]\r\n ira_doc = linhas_uteis[3][-3]\r\n mencao_doc = linhas_uteis[4][-2]\r\n\r\n self.update(fk_status_monitoria_id: 2)\r\n\r\n #validacao de matricula\r\n if matricula_doc.length != 9 or matricula_doc != \"#{matricula_doc.to_i}\"\r\n return 'Recusado pela matricula'\r\n end\r\n\r\n #validacao de mencao\r\n if mencao_doc != \"SS\" and mencao_doc != \"MS\" \r\n return 'Recusado pela mencao'\r\n end\r\n\r\n #validacao IRA\r\n num_ira = ira_doc.to_f\r\n if num_ira < 0 or num_ira > 5\r\n return 'Recusado pelo IRA'\r\n end\r\n if(self.remuneracao == 'Remunerado' and num_ira < 3.5)\r\n return 'Recusado pelo IRA para monitoria remunerada'\r\n end\r\n\r\n self.update(fk_status_monitoria_id: 3)\r\n return \"Aceito\"\r\n \r\n end", "def case_plateau(l,c)\n return self.grilleS.grille[l][c]\n end", "def nbLienCasePossible(tabLien)\r\n compteur=0\r\n for i in 0..3 do\r\n if(@tabTriangle[i]==true )\r\n val=( 2 - self.nbLienEntreDeuxCases(tabLien,i) )\r\n if(val > (@tabVoisins[i].etiquetteCase.to_i-@tabVoisins[i].nbLienCase(tabLien)) )\r\n val=(@tabVoisins[i].etiquetteCase.to_i-@tabVoisins[i].nbLienCase(tabLien))\r\n end\r\n compteur+= val\r\n end\r\n end\r\n return compteur\r\n end", "def afficherErreur(tabErr: @erreurs, filtre: true, index: -1)\n if(tabErr == nil)\n tabErr = @erreurs\n end\n\n if(index < -1 || index >= tabErr.size)\n raise ArgumentError, \"Index d'erreur incorrect\"\n end\n if (index == -1)\n if(filtre)\n for e in tabErr\n if(e[0] != :LIGNE_PLEINE_NON_PRESENTE)\n printErreur(e)\n end\n end\n else\n for e in tabErr\n printErreur(e)\n end\n end\n else\n printErreur(@erreurs[i])\n end\n return self\n end", "def goodVsEvil(good, evil)\n goodcounter = 0\n evilcounter = 0\n good.split(\" \").each_with_index do |n,i|\n case i\n when 0\n goodcounter += (n.to_i*1)\n when 1\n goodcounter += (n.to_i*2)\n when 2\n goodcounter += (n.to_i*3)\n when 3\n goodcounter += (n.to_i*3)\n when 4\n goodcounter += (n.to_i*4)\n when 5\n goodcounter += (n.to_i*10)\n end\n end\n evil.split(\" \").each_with_index do |n,i|\n case i\n when 0\n evilcounter += (n.to_i*1)\n when 1\n evilcounter += (n.to_i*2)\n when 2\n evilcounter += (n.to_i*2)\n when 3\n evilcounter += (n.to_i*2)\n when 4\n evilcounter += (n.to_i*3)\n when 5\n evilcounter += (n.to_i*5)\n when 6\n evilcounter += (n.to_i*10)\n end\n end\n if goodcounter > evilcounter\n return \"Battle Result: Good triumphs over Evil\"\n elsif evilcounter > goodcounter\n return \"Battle Result: Evil eradicates all trace of Good\"\n elsif goodcounter == evilcounter\n return \"Battle Result: No victor on this battle field\"\n end\nend", "def aSommetVoisin()\n if(@grille != nil)\n #puts \"dimension de la grille : \" + @grille.longueur.to_s + \":\" + @grille.largeur.to_s\n #puts \"test du voisin gauche, y = \" + y.to_s\n boolSommetGauche = y-1 >= 0 ? @grille.getCase(x, y-1).contenu.is_a?(Sommet) : false\n #puts \"test du voisin droit, y = \" + y.to_s\n boolSommetDroit = y+1 < @grille.largeur ? @grille.getCase(x, y+1).contenu.is_a?(Sommet) : false\n #puts \"test du voisin haut, x = \" + x.to_s\n boolSommetHaut = x-1 >= 0 ? @grille.getCase(x-1, y).contenu.is_a?(Sommet) : false\n #puts \"test du voisin bas, x = \" + x.to_s\n boolSommetBas = x+1 < @grille.longueur ? @grille.getCase(x+1, y).contenu.is_a?(Sommet) : false\n return boolSommetGauche || boolSommetDroit || boolSommetHaut || boolSommetBas\n else\n return false\n end\n end", "def testArchipel1(case1)\r\n compteur=0\r\n\r\n\r\n if(case1.nbLienCase(@tabLien)==case1.etiquetteCase.to_i-1)\r\n\r\n for i in 0..3 do\r\n if(case1.tabTriangle[i]==true)\r\n lien=case1.creerLien(i,false,tabLien)\r\n self.actuCroisement()\r\n if( ArchiNonComplete(case1,Array.new()) )\r\n compteur+=1\r\n end\r\n supprimerLien(lien)\r\n end\r\n end\r\n\r\n end\r\n\r\n if(compteur==1)\r\n return true\r\n end\r\n return false\r\n end", "def invalid_ranges\n @ranges.reject(&:accepted).map { |range| [@tiers, range.string].flatten.join(TAB) }\n end", "def check_controllo_offerte(file_controlo)\n sheet = apri_file(file_controlo)\n tabella_controlli = [sheet.column(2),sheet.column(3)]\n tabella_controlli[0].each_with_index do |x,y|\n if x == \"FLUSSO\"\n unless tabella_controlli[1][0] == $data\n @errore << \"Nel file #{file_controlo.basename} c'è una data diversa da quella selezionata\"\n end\n else\n unless tabella_controlli[1][y] == \"OK\"\n @errore << \"Nel file #{file_controlo.basename} il \\\"#{tabella_controlli[0][y]}\\\" non è OK\"\n end\n end\n end\n end", "def mostrar_ganador(tablero)\r\n bandera_ganador=false#como aun no hay ganador mi bandera ganador es falsa desde el incio\r\n #para la fila 1\r\n if tablero[0][0]==\"X\" and tablero[0][1]==\"X\" and tablero[0][2]==\"X\"#condicinante de las cordenadas y el valor que debe estar en ellas\r\n ganador=\"¡¡¡Gana el jugador X!!!\"#guardo en una varible una mensaje del ganador\r\n bandera_ganador=true#como si hay ganador mi bandera ganador se vuelve verdadera\r\n\t\t#hago exacamente lo mismo para todas los demas posibles resultados\r\n elsif tablero[0][0]==\"O\" and tablero[0][1]==\"O\" and tablero[0][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para la fila 2\r\n elsif tablero[1][0]==\"X\" and tablero[1][1]==\"X\" and tablero[1][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[1][0]==\"O\" and tablero[1][1]==\"O\" and tablero[1][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para la fila 3\r\n elsif tablero[2][0]==\"X\" and tablero[2][1]==\"X\" and tablero[2][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[2][0]==\"O\" and tablero[2][1]==\"O\" and tablero[2][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para columna 1\r\n elsif tablero[0][0]==\"X\" and tablero[1][0]==\"X\" and tablero[2][0]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][0]==\"O\" and tablero[1][0]==\"O\" and tablero[2][0]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para columna 2\r\n elsif tablero[0][1]==\"X\" and tablero[1][1]==\"X\" and tablero[2][1]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][1]==\"O\" and tablero[1][1]==\"O\" and tablero[2][1]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para columna 3\r\n elsif tablero[0][2]==\"X\" and tablero[1][2]==\"X\" and tablero[2][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][2]==\"O\" and tablero[1][2]==\"O\" and tablero[2][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para diagonal 1\\\r\n elsif tablero[0][0]==\"X\" and tablero[1][1]==\"X\" and tablero[2][2]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][0]==\"O\" and tablero[1][1]==\"O\" and tablero[2][2]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n #para diagonla 2/\r\n elsif tablero[0][2]==\"X\" and tablero[1][1]==\"X\" and tablero[2][0]==\"X\"\r\n ganador=\"¡¡¡Gana el jugador X!!!\"\r\n bandera_ganador=true\r\n elsif tablero[0][2]==\"O\" and tablero[1][1]==\"O\" and tablero[2][0]==\"O\"\r\n ganador=\"¡¡¡Gana el jugador O!!!\"\r\n bandera_ganador=true\r\n else\r\n ganador=\"Aun no hay ganador...\"#Digo que aun no hay ganador alguno\r\n bandera_ganador=false#si no se cumplio alguna de las condiciones anteriores, la bandera ganador sigue siendo falsa\r\n\tend\r\n print ganador#imprimo el ganador\r\n return bandera_ganador#regreso la bandera jugador, que se conectara en la variable que se encuentra en cel codigo principal, para decidir si se rompe o no el programa\r\nend", "def get_cours(sigle, les_cours)\n erreur \"Format de sigle incorrect: #{sigle}\" unless sigle =~ Motifs::SIGLE\n cours = les_cours.find { |cours| cours.sigle.to_s == sigle }\n erreur \"Aucun cours: #{sigle}\" unless cours\n cours\nend", "def rad2_not_null(row)\n unless row.radicanti_esterni.nil?\n if row.radicanti_esterni == 2\n unless !row.copertura.nil? && !row.altezza.nil? && row.eta_strutturale.nil? && row.danni_meccanici.nil? && row.danni_parassitari.nil?\n #segnalo l'errore\n multiple_parameter_error(row,\"Radicanti Esterni = 2, violazione not null in copertura,altezza null in eta strutturale,danni meccanici,danni parassitari\")\n end\n end\n end\n end", "def verificarMayorIgualQue(expresion, tablaActual)\n #Se busca en los alcances hasta encontrar la primera expresion valida a izquierda\n tablaAux = tablaActual\n izquierda = verificarExpresion(expresion.izquierda, tablaAux)\n \n while (!izquierda and !tablaAux.nil?)\n izquierda = verificarExpresion(expresion.izquierda, tablaAux)\n tablaAux = tablaAux.obtenerPadre()\n end\n \n #Se busca en los alcances hasta encontrar la primera expresion valida a derecha\n tablaAux = tablaActual\n derecha = verificarExpresion(expresion.derecha, tablaAux)\n \n while (!derecha and !tablaAux.nil?)\n derecha = verificarExpresion(expresion.derecha, tablaAux)\n tablaAux = tablaAux.obtenerPadre()\n end \n \n #Se verifica si ambas variables son de tipo int\n if (izquierda.eql? \"int\" and derecha.eql? \"int\") then\n return \"bool\"\n else \n tokenAux = expresion.izquierda\n \n while (!(tokenAux.class.eql? Identificador) and !(tokenAux.class.eql? LitNum) and !(tokenAux.class.eql? LitChar) and !(tokenAux.class.eql? LitTrue) and !(tokenAux.class.eql? LitFalse))\n tokenAux = tokenAux.izquierda\n end\n error = \"Error en línea #{tokenAux.token.linea}: los tipos de la operacion MAYOR IGUAL QUE son diferentes\"\n $tablaErrores << error\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
before_action :authenticate_admin! GET /smsloans GET /smsloans.json
def index @smsloans = Smsloan.all end
[ "def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end", "def smsmark\n http = get_http_connection() \n post_args = { 'ids' => params[:ids], 'name' => @pysmsd_config.app_name, 'password' => @pysmsd_config.app_password }\n request = Net::HTTP::Post.new('/messages/in.json')\n request.set_form_data(post_args)\n resp = http.request(request)\n json = JSON.parse(resp.body)\n render_json :entry => json\n end", "def index\n slogans = Slogan.order('id ASC');\n render json: {\n status: 'Success',\n message: 'Loaded slogans',\n data: slogans,\n code: 200,\n }\n end", "def sms\r\n SMSController.instance\r\n end", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "def index\n @talismans = Talisman.where(\"user_id = ?\", current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talismans }\n end\n end", "def show #show system admin view\n if current_user\n redirect_to logged_in_path and return\n end\n \n if session[:sysadmin] == \"true\" or (params[:sysadmin][:username] == 'gus' and params[:sysadmin][:password] == 'lospollos')\n session[:sysadmin] = \"true\"\n @actions = Action.all\n render 'show'\n else\n flash[:notice] = \"Wrong email/password combination.\"\n redirect_to(:action => 'new') \n end\n end", "def show\n @sms_lingo = SmsLingo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sms_lingo }\n end\n end", "def dashboard\n # displays the admin dashboard if current user is admin\n if current_user.is_admin\n # retrieves a list of all users, ordered by username\n @users = User.order(\"username\")\n render :admin_dashboard\n # sold parameter can be toggled on the dashboard to display either sold or unsold listings\n elsif params[:sold]\n @sold = true\n # retrieves a paginated list of all of the users SOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is true\").order(\"created_at desc\").page params[:page]\n else\n @sold = false\n # retrieves a paginated list of all of the users UNSOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is false\").order(\"created_at desc\").page params[:page]\n end\n end", "def me\n if admin_signed_in?\n render json: current_admin.to_json(only: [:id, :email, :login_method])\n else\n render json: { error: '401 Unauthorized' }, status: :unauthorized\n end\n end", "def index\n @sms_alerts = @account.sms_alerts\n end", "def index\n #@loans = Loan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end", "def index\n @admin_masjids = Masjid.all\n end", "def index\n @smsusers = Smsuser.all\n end", "def index\n authorize! :admin, :dashboard\n @twitter_blocks = TwitterBlock.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'id ASC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @twitter_blocks }\n end\n end", "def dashboard\n end", "def manage_admins\n @userId = UserService.find_user session[:user]\n @admins = UserService.all_admin_users\n flash.delete(\"error\")\n end", "def admin_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see list of users.'\n redirect_to(root_url)\n end\n end", "def login\n admin = Admin.find_by(email: params[:email])\n puts admin\n if admin && admin.authenticate(params[:password])\n token = encode_token({admin_id: admin.id})\n render json: {admin: admin, token: token} \n else\n render json: {errors: \"Invalid email/password combination\"}\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /smsloans/1 PATCH/PUT /smsloans/1.json
def update respond_to do |format| if @smsloan.update(smsloan_params) format.html { redirect_to @smsloan, notice: 'Smsloan was successfully updated.' } format.json { render :show, status: :ok, location: @smsloan } else format.html { render :edit } format.json { render json: @smsloan.errors, status: :unprocessable_entity } end end end
[ "def update\n @sms_lingo = SmsLingo.find(params[:id])\n\n respond_to do |format|\n if @sms_lingo.update_attributes(params[:sms_lingo])\n format.html { redirect_to @sms_lingo, notice: 'Sms lingo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sms_lingo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sms = Sms.find(params[:id])\n\n respond_to do |format|\n if @sms.update_attributes(params[:sms])\n format.html { redirect_to @sms, notice: 'Sms was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sms.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sms_request = SmsRequest.find(params[:id])\n\n respond_to do |format|\n if @sms_request.update_attributes(params[:sms_request])\n format.html { redirect_to @sms_request, notice: 'Sms request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sms_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_based.update(sms_based_params)\n format.html { redirect_to @sms_based, notice: 'Sms based was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sms_based.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sms = Sm.find(params[:id])\n\n respond_to do |format|\n if @sms.update_attributes(params[:sm])\n format.html { redirect_to @sms, notice: 'Sm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sms.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @smsmessage = Smsmessage.find(params[:id])\n\n respond_to do |format|\n if @smsmessage.update_attributes(params[:smsmessage])\n format.html { redirect_to @smsmessage, notice: 'Smsmessage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smsmessage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sms = Sms.find(params[:id])\n\n respond_to do |format|\n if @sms.update_attributes(params[:sms])\n flash[:notice] = 'Sms was successfully updated.'\n format.html { redirect_to(@sms) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sms.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smsrequest.update(smsrequest_params)\n format.html { redirect_to @smsrequest, notice: 'Smsrequest was successfully updated.' }\n format.json { render :show, status: :ok, location: @smsrequest }\n else\n format.html { render :edit }\n format.json { render json: @smsrequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smsno.update(smsno_params)\n format.html { redirect_to @smsno, notice: 'Smsno was successfully updated.' }\n format.json { render :show, status: :ok, location: @smsno }\n else\n format.html { render :edit }\n format.json { render json: @smsno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t \tif @sms_send.update(sms_send_params)\n\t \t\trespond_to do |format|\n\t \tformat.json {\n\t \t render json: {status:0, msg:\"success\"}\n\t \t}\n\t end\n\t else\n\t \trespond_to do |format|\n\t\t format.json {\n\t\t render json: {status:-1, msg:\"fail\"}\n\t\t }\n\t\t end \n\t end\n end", "def update\n respond_to do |format|\n if @smsreceived.update(smsreceived_params)\n format.html { redirect_to @smsreceived, notice: 'Smsreceived was successfully updated.' }\n format.json { render :show, status: :ok, location: @smsreceived }\n else\n format.html { render :edit }\n format.json { render json: @smsreceived.errors, status: :unprocessable_entity }\n end\n end\n end", "def sms_update\n # find notification through external id\n notif = Notification.find_by(sms_notification_external_id: required_params[:id])\n # log external id if notification doesn't exist\n return log_error(required_params[:notification_type]) unless notif\n\n # update notification if it exists\n notif.update!(sms_notification_status: params[:status])\n render json: { message: \"SMS notification successfully updated: ID \" + required_params[:id] }\n end", "def update\n respond_to do |format|\n if @smsmsg.update(smsmsg_params)\n format.html { redirect_to @smsmsg, notice: 'Smsmsg was successfully updated.' }\n format.json { render :show, status: :ok, location: @smsmsg }\n else\n format.html { render :edit }\n format.json { render json: @smsmsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sms_client = SmsClient.find(params[:id])\n\n respond_to do |format|\n if @sms_client.update_attributes(params[:sms_client])\n format.html { redirect_to @sms_client, notice: 'Sms client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sms_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @smsalert_check = SmsalertCheck.find(params[:id])\n\n respond_to do |format|\n if @smsalert_check.update_attributes(params[:smsalert_check])\n format.html { redirect_to @smsalert_check, notice: 'Smsalert check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smsalert_check.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @call1 = Call1.find(params[:id])\n\n respond_to do |format|\n if @call1.update_attributes(params[:call1])\n format.html { redirect_to @call1, notice: 'Call1 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_notification.update(sms_notification_params)\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @sms_notification }\n else\n format.html { render :edit }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_retrieval.update(sms_retrieval_params)\n format.html { redirect_to @sms_retrieval, notice: 'Sms retrieval was successfully updated.' }\n format.json { render :show, status: :ok, location: @sms_retrieval }\n else\n format.html { render :edit }\n format.json { render json: @sms_retrieval.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sms_send.update(sms_send_params)\n format.html { redirect_to [:phone, @sms_send], notice: 'Sms send was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sms_send.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /smsloans/1 DELETE /smsloans/1.json
def destroy @smsloan.destroy respond_to do |format| format.html { redirect_to smsloans_url, notice: 'Smsloan was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_lingo = SmsLingo.find(params[:id])\n @sms_lingo.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_lingos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms = Sm.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_request = SmsRequest.find(params[:id])\n @sms_request.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_client = SmsClient.find(params[:id])\n @sms_client.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_send.destroy\n respond_to do |format|\n format.json {\n render json: {status:0, msg:\"success\"}\n }\n end\n end", "def destroy\n @smsmessage = Smsmessage.find(params[:id])\n @smsmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to smsmessages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sm = Sm.find(params[:id])\n @sm.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_log = SmsLog.find(params[:id])\n @sms_log.destroy\n\n respond_to do |format|\n format.html { redirect_to sms_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smsrequest.destroy\n respond_to do |format|\n format.html { redirect_to smsrequests_url, notice: 'Smsrequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @smsalert_check = SmsalertCheck.find(params[:id])\n @smsalert_check.destroy\n\n respond_to do |format|\n format.html { redirect_to smsalert_checks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @smsno.destroy\n respond_to do |format|\n format.html { redirect_to smsnos_url, notice: 'Smsno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @smsreceived.destroy\n respond_to do |format|\n format.html { redirect_to smsreceiveds_url, notice: 'Smsreceived was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_tmp.destroy\n respond_to do |format|\n format.html { redirect_to sms_tmps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_retrieval.destroy\n respond_to do |format|\n format.html { redirect_to sms_retrievals_url, notice: 'Sms retrieval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sms_campaign.destroy\n respond_to do |format|\n format.html { redirect_to sms_campaigns_url, notice: 'Sms campaign was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @phone_item = PhoneItem.find(params[:id])\n @phone_item.destroy\n\n respond_to do |format|\n format.html { redirect_to '/home/sms' }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /image_groups/1 GET /image_groups/1.json
def show @image_group = ImageGroup.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @image_group } end end
[ "def index\n @image_groups = ImageGroup.all\n end", "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end", "def group_album\n @discussion_group = DiscussionGroup.find(params[:id])\n if @login_user.is_member_of_discussion_group(params[:id].to_i) || @discussion_group.is_public\n @pictures = @discussion_group.images.limit(20).order(\"photo_updated_at DESC \")\n else\n redirect_to @login_user.profile_path\n end\n end", "def index\n @image_gallery_groups = ImageGalleryGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_gallery_groups }\n end\n end", "def index\n @gallery_groups = GalleryGroup.all\n end", "def query_image_scg_list\n query_image_list\n get_url('compute')\n @resource_id_list.each do |img|\n ind = @resource_id_list.index(img)\n puts \"The supported Storage Connectivity groups for the image #{@resource_name_list[ind]} are:\"\n response = rest_get(\"#{@resource_url}/images/#{img}/storage-connectivity-groups\", @token_id)\n response_array = JSON.parse(response)\n @response_hash = response_array['storage_connectivity_groups']\n @response_hash.each do |scg|\n puts scg['display_name']\n end\n end\n end", "def group\n limit = (params[:limit] || 10).to_i\n page = (params[:page] || 1).to_i\n @group_id = params[:object_id] unless params[:object_id]=='null'\n @photos = FacebookPhoto.fetch_from_fb_group(@group_id, current_user, {:limit => limit, :page => page})\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false\n }\n end\n end\n end", "def get_user_groups\n path = self.api_root + \"/api/groups\"\n process_firecloud_request(:get, path)\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def groups\n result = get(\"groups\")\n end", "def group_album\n @discussion_group = DiscussionGroup.find(params[:id])\n if @login_user.is_member_of_discussion_group(params[:id].to_i) || @discussion_group.is_public\n @pictures = Image.find_by_sql([\"SELECT DISTINCT i.* FROM discussion_group_discussions dgd\n\t\t\t\t\t LEFT JOIN discussions d on dgd.discussion_id = d.id\n\t\t\t\t\t LEFT JOIN comments c on dgd.discussion_id = c.discussion_id\n\t\t\t\t\t LEFT JOIN images i ON (imageable_id = dgd.id AND imageable_type = 'DiscussionGroup')\n\t\t\t\t\t OR (imageable_id = d.id AND imageable_type = 'Discussion')\n\t\t\t\t\t OR (imageable_id = c.id AND imageable_type = 'Comment')\n \t\t\t\t\tWHERE i.id IS NOT NULL AND dgd.discussion_group_id =? \",params[:id].to_i])\n else\n redirect_to @login_user.profile_path\n end\n end", "def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end", "def show\n objid = params[:id]\n obj = ManagingGroup.find_by_id(objid)\n if obj\n render json: {managing_group: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end", "def new\n @image_gallery_image = @image_gallery_group.images.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_gallery_image }\n end\n end", "def groups(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['groups_full'], params)\n parse_groups response_body(response)\n end", "def create\n @image_group = ImageGroup.new(image_group_params)\n respond_to do |format|\n begin\n if @image_group.save\n flash[:success] = 'Image group was successfully created.'\n format.html { redirect_to admin_image_group_url(@image_group) }\n format.json { render :show, status: :created, location: @image_group }\n else\n format.html { render :new }\n format.json { render json: @image_group.errors, status: :unprocessable_entity }\n end\n rescue Exception => e\n flash[:danger] = \"Oops! Something went wrong: #{e.message}\"\n format.html { render :new }\n end\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" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /image_groups/1 PUT /image_groups/1.json
def update puts params[:image_group] puts params[:image_group][:promoted] p ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" if !params[:images][:removed].blank? puts "removed images" + params[:images][:removed] removedImages = Image.where(" id in (?)", params[:images][:removed].split(',')) #remove the image from a group removedImages.each do |ri| ri.group_id=nil ri.save end end if !params[:images][:added].blank? puts "new added images" + params[:images][:added] addedImages = Image.where(" id in (?)", params[:images][:added].split(',')) #remove the image from a group addedImages.each do |ai| ai.group_id=params[:id] ai.save end end @image_group = ImageGroup.find(params[:id]) if params[:image_group][:cover_image_id].nil? @image_group.errors.add(:nil_cover, "必须指定封面图片才能使该图组生效") return elsif @image_group.images.nil? @image_group.errors.add(:nil_images, "必须指定内容图片才能使该图组生效") return end respond_to do |format| if @image_group.update_attributes(params[:image_group]) format.html { redirect_to @image_group, notice: 'Image group was successfully updated.' } format.json { head :no_content } format.js {} else format.html { render action: "edit" } format.json { render json: @image_group.errors, status: :unprocessable_entity } format.js {} end end end
[ "def update\n respond_to do |format|\n begin\n if @image_group.update(image_group_params)\n flash[:success] = 'Image group was successfully updated.'\n format.html { redirect_to admin_image_group_url(@image_group) }\n format.json { render :show, status: :ok, location: @image_group }\n else\n format.html { render :edit }\n format.json { render json: @image_group.errors, status: :unprocessable_entity }\n end\n rescue Exception => e\n flash[:danger] = \"Oops! Something went wrong: #{e.message}\"\n format.html { render :new }\n end\n end\n end", "def update_group(group_id, request)\n start.uri('/api/group')\n .url_segment(group_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "def update_group(group_id, request)\n start.uri('/api/group')\n .url_segment(group_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\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 options = {\n :search => params[:search],\n :sort => params[:sort],\n :page => params[:page],\n :anchor => :images,\n }\n redirect_url = send(\"#{ parent_type }_url\", parent, options)\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @server_image_group = ServerImageGroup.find(params[:id])\n\n respond_to do |format|\n if @server_image_group.update_attributes(params[:server_image_group])\n flash[:notice] = 'ServerImageGroup was successfully updated.'\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n format.js\n else\n @error_messages = @server_image_group.errors.collect{ |e| e[0].humanize+' - '+e[1] }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server_image_group.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end\n end", "def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end", "def update\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n\n respond_to do |format|\n if @image_gallery_group.update_attributes(params[:image_gallery_group])\n flash[:notice] = 'ImageGalleryGroup was successfully updated.'\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_gallery_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_nodegroup(nodegroup_json, nodegroup_id)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=nodegroup_id, nodegroup_json)\nend", "def update_group(id, params)\n put(\"groups/#{id}\", group: params)\n end", "def create\n @image_group = ImageGroup.new(image_group_params)\n respond_to do |format|\n begin\n if @image_group.save\n flash[:success] = 'Image group was successfully created.'\n format.html { redirect_to admin_image_group_url(@image_group) }\n format.json { render :show, status: :created, location: @image_group }\n else\n format.html { render :new }\n format.json { render json: @image_group.errors, status: :unprocessable_entity }\n end\n rescue Exception => e\n flash[:danger] = \"Oops! Something went wrong: #{e.message}\"\n format.html { render :new }\n end\n end\n end", "def put_new_group(group_name)\n c = curl_put(\"#{self.host}/api2/groups/\",{\"group_name\" => group_name})\n JSON.parse(c.body_str)\n end", "def update_group(group_name, options = {})\n request({\n 'Action' => 'UpdateGroup',\n 'GroupName' => group_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateGroup.new\n }.merge!(options))\n end", "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def create\n @groupimage = Groupimage.new(groupimage_params)\n\n respond_to do |format|\n if @groupimage.save\n format.html { redirect_to @groupimage, notice: 'Groupimage was successfully created.' }\n format.json { render :show, status: :created, location: @groupimage }\n else\n format.html { render :new }\n format.json { render json: @groupimage.errors, status: :unprocessable_entity }\n end\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_group(group_name, options={})\n request_hash = { 'GroupName' => group_name}\n request_hash['NewGroupName'] = options[:new_group_name] unless options[:new_group_name].right_blank?\n request_hash['NewPath'] = options[:new_path] unless options[:new_path].right_blank?\n link = generate_request(\"UpdateGroup\", request_hash)\n request_info(link, RightHttp2xxParser.new(:logger => @logger))\n end", "def update\n respond_to do |format|\n if @os_groups_group.update(os_groups_group_params)\n format.html { redirect_to @os_groups_group, notice: 'Os groups group was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_groups_group }\n else\n format.html { render :edit }\n format.json { render json: @os_groups_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def editgroup\n if(params[:editgroup] && params[:editgroup][:id] && params[:editgroup][:name]&& params[:editgroup][:description])\n\n group = Group.find(params[:editgroup][:id])\n \n gpinfo = {:name => params[:editgroup][:name], \n :description => params[:editgroup][:description], \n :creator => group.creator, \n :self => group.self}\n\n if group.update_attributes(gpinfo)\n render :json => group.to_json(:include => {\n :users => {:except => [:created_at, :updated_at, :password_digest, :remember_token]},\n :pending_users => {:except => [:created_at, :updated_at,:password_digest, :remember_token]\n }}), :status => 200\n else\n render :json => group.errors.full_messages, :status => 400\n end\n else\n render :json => [\"Group ID Param not Found\"], :status => 400\n end\n end", "def update options = {}\n\n group_opts = group_options(options) \n\n # tags must be updated using a separate request from the\n # other attributes, *sigh*\n if tags = group_opts.delete(:tags)\n tags.map(&:to_hash).each do |tag|\n tag[:resource_type] = 'auto-scaling-group'\n tag[:resource_id] = name\n end\n client.create_or_update_tags(:tags => tags)\n end\n\n unless group_opts.empty?\n client_opts = group_opts.merge(:auto_scaling_group_name => name)\n client.update_auto_scaling_group(client_opts)\n end\n\n nil\n\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /image_groups/1 DELETE /image_groups/1.json
def destroy @image_group = ImageGroup.find(params[:id]) @image_group.destroy respond_to do |format| format.html { redirect_to image_groups_url } format.json { head :no_content } format.js {} end end
[ "def destroy\n @image_group_item.destroy\n respond_to do |format|\n flash[:success] = 'Image group item was successfully deleted.'\n format.html { redirect_to admin_image_group_url(@image_group) }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group.destroy\n\n respond_to do |format|\n format.html { redirect_to( admin_image_gallery_groups_url ) }\n format.xml { head :ok }\n end\n end", "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "def destroy\n @group = @dataset.groups.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to dataset_groups_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.group.one'))} }\n format.json { head :no_content }\n end\n end", "def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end", "def delete_image\n if request.post? == false\n render :json => { :message => \"Error\" }\n return\n end\n image = Image.new\n image.byId( params[ :image_id ] )\n collection = Collection.new\n collection.byId( params[ :collection_id ] )\n collection.delete( :images, image.urn )\n render :json => { \n :message => \"Success\", \n :collection => collection.all \n }\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 @bp_pic_group = BpPicGroup.find(params[:id])\n @bp_pic_group.destroy\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_group.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n options = {\n :search => params[:search],\n :sort => params[:sort],\n :page => params[:page],\n :anchor => :images,\n }\n redirect_url = send(\"#{ parent_type }_url\", parent, options)\n\n @server_image_group = ServerImageGroup.find(params[:id])\n @server_image_group.destroy\n\n respond_to do |format|\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @assetgroup.destroy\n respond_to do |format|\n format.html { redirect_to assetgroups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meta_data_group = MetaDataGroup.find(params[:id])\n @meta_data_group.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_data_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @onion_group.destroy\n respond_to do |format|\n format.html { redirect_to onion_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_gallery_image = ImageGalleryImage.find(params[:id])\n @image_gallery_image.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group_key.destroy\n respond_to do |format|\n format.html { redirect_to group_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage_group = StorageGroup.find(params[:id])\n @storage_group.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_group.destroy\n respond_to do |format|\n format.html { redirect_to small_groups_url, notice: '' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_file.destroy\n respond_to do |format|\n format.html { redirect_to group_files_url, notice: 'Group file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @collection_group.destroy\n respond_to do |format|\n format.html { redirect_to collection_groups_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the build numbers for this Windows, e.g. 5.2.3790.
def get_build if defined?(@major) and defined?(@minor) and defined?(@build) then return @major, @minor, @build else @major, @minor, @build = nil end search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll') ntdlls = Dir.glob(search, File::FNM_CASEFOLD) if ntdlls.length > 0 dumpvers = %x{pev -p #{ntdlls.first}} if $?.success? major, minor, build = dumpvers.split('.') @major, @minor, @build = Integer(major), Integer(minor), Integer(build) end else search = File.join(@path, 'sources/{setup.exe,winsetup.dll}') setup = Dir.glob(search, File::FNM_CASEFOLD) setup.each do |file| dumpvers = %x{pev -p #{file}} if $?.success? major, minor, build = dumpvers.split('.') @major, @minor, @build = Integer(major), Integer(minor), Integer(build) break end end # end of setup block begin get_xmlinfo if not defined?(@xmlinfo) majors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MAJOR/text()') minors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MINOR/text()') builds = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/BUILD/text()') major = majors.first # The install.wim image will have multiple sub- minor = minors.first # images. Check to make sure each one has the same build = builds.first # version number. if majors.count(major) == majors.size and minors.count(minor) == minors.size and builds.count(build) == builds.size then @major, @minor, @build = Integer(major.to_s), Integer(minor.to_s), Integer(build.to_s) end rescue Exception => e # puts "error(get_build): #{e}" # raise end end return @major, @minor, @build end
[ "def os_build_number\n return @os_build_number\n end", "def windows_version_parts\n version = self.version\n if version\n # windows-server-* -> windows-*\n if version.split(\"-\", 2)[0] == \"server\"\n version = version.split(\"-\", 2)[1]\n end\n\n if version =~ /^(\\d+)(r\\d+)?(sp\\d+|rtm)?$/i\n major, revision, service_pack = Regexp.last_match[1..3]\n end\n end\n\n if major\n # Get major as an integer (2008 -> 2008, 7 -> 7)\n major = major.to_i\n\n # Get revision as an integer (no revision -> 0, R1 -> 1).\n revision = revision ? revision[1..-1].to_i : 0\n\n # Turn service_pack into an integer. rtm = 0, spN = N.\n if service_pack\n service_pack = (service_pack.casecmp(\"rtm\") == 0) ? 0 : service_pack[2..-1].to_i\n end\n end\n\n [major, revision, service_pack]\n end", "def all_build_train_numbers(platform: nil)\n return self.build_trains(platform: platform || self.platform).versions\n end", "def build_number\n return 'development' if build_mode == :development\n return @build_number ||= SC.library.compute_build_number(self)\n end", "def current_build_number\n return current_build.number\n end", "def build_number\n return @build_number\n end", "def find_build_numbers(*targets)\n if options['build-numbers']\n numbers = {}\n options['build-numbers'].split(',').each do |pair|\n pair = pair.split(':')\n if pair.length < 2\n fatal! \"Could not parse build numbers! #{options['build-numbers']}\"\n end\n numbers[\"/#{pair[0]}\"] = pair[1]\n end\n SC.env.build_numbers = numbers\n SC.logger.info \"Using build numbers: #{numbers.map { |k,v| \"#{k}: #{v}\" }.join(',')}\"\n end\n end", "def svc_build_info(env, solution)\n url = \"http://#{env}.services.gamestop.com/Ecom/#{solution}/buildinfo.txt\"\n build_text_file = []\n open(url) do |f|\n no = 1\n f.each do |lines|\n build_text_file << lines\n no += 1\n break if no > 100\n end\n end\n #version = open(url).source.match(/(^Build Number)(.*)(_\\d*\\.\\d*)/)[3]\n return build_text_file\n end", "def get_build_number()\n return ENV['DOCS_BUILD_NUMBER'] || \"HEAD\"\n end", "def os_build_number=(value)\n @os_build_number = value\n end", "def component_versions(cmp)\n component_build_vars(cmp)['PACKAGE_VERSIONS']\nend", "def build_version; property(@device.PROP_BUILD_VERSION) end", "def prepare_build_numbers!\n return unless (numbers = options[:build])\n numbers = numbers.split(',').map { |n| n.split(':') }\n if numbers.size==1 && numbers.first.size==1\n SC.env.build_number = numbers.first.first\n else\n hash = {}\n numbers.each do |pair|\n key = pair[0]\n key = \"/#{key}\" if !(key =~ /^\\//)\n hash[key.to_sym] = pair[1]\n end\n end\n end", "def detect\n return if NETBuildpack::Runtime::Stack.detect_stack == :windows\n id @version\n end", "def next_build_number\n data(\"nextBuildNumber\")\n end", "def get_buildno\n $buildno= @browser.execute_script(\"return window.DG.BUILD_NUM\")\n puts \"CODAP build_num is #{$buildno}.\"\nend", "def generate_build_number\n if project.ios?\n self.build_number = Time.now.strftime('%Y%m%d%H%M')\n elsif project.android?\n if environment.current_version_properties.present?\n self.build_number = environment.current_version_properties[:'version.code']\n else\n self.build_number = ''\n end\n end\n self.save\n self.build_number\n end", "def existing_builds_numbers(build_nums)\n Build.select(:build_number).where(build_number: build_nums).map { |build| build.build_number }\n end", "def version_components\n if @version_components.nil?\n comps = version.split(\".\")\n @version_components = comps.map { |v| v.to_i }\n end\n\n @version_components\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a description string for this version of Windows.
def get_winstring if defined?(@description) then return @description else @description = nil end get_build if not @major if @major < 6 # Vista and up use install.wim version = "#{@major}.#{@minor}" releases = { '5.0' => { 2195 => 'Windows 2000' }, '5.1' => { 2600 => 'Windows XP' }, '5.2' => { 2600 => 'Windows XP', 3790 => 'Windows Server 2003' } } # Get the closest build. Makes more sense with a bigger table. closest, description = releases[version].first releases[version].each do |build, name| if (build-@build).abs < (closest-@build).abs description = name closest = build end end # end of releases block @description = description else # Only works for ISO images for now. Use hivex for OS-root folders. begin substitutions = { # Products that don't have good descriptions. 'ServerSBSStandard' => 'Windows Small Business Server', 'SERVERSBSSTANDARD' => 'Windows Small Business Server', 'ServerHomeStandard' => 'Windows Home Server', 'ServerHomePremium' => 'Windows Home Server', 'Windows Longhorn' => 'Windows Server 2008', 'Windows Longhorn Client' => 'Windows Vista' } get_xmlinfo if not defined?(@xmlinfo) imagecount = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE').length descriptions = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/NAME/text()') description = String.new(descriptions.first.to_s) if descriptions.length > 1 # Get common name prefixes to ignore product editions, # like 'Ultimate' or 'Home Basic'. Do this by counting each # individual word from the product names and removing those # words that only appear once. It is important to remove them # longest-word-first, since some editions are substrings of # another, e.g. SERVERSTANDARD and SERVERSTANDARDCORE. If there # are any non-matching versions of Windows, it is too hard to # say which one is going to get installed, so return 'Windows'. descriptions = descriptions.map { |xml| xml.to_s.split } descriptions = descriptions.flatten wordcounts = Hash.new(0) descriptions.each { |word| wordcounts[word] += 1 } wordcounts = wordcounts.reject { |word, count| count == imagecount } sorted = wordcounts.keys.sort_by { |string| string.length } sorted.reverse_each { |word, count| description.slice! word } description.rstrip! end description = 'Windows' if description.empty? @description = substitutions.keys.include?(description) ? substitutions[description] : description rescue @description = "Windows" end end @description end
[ "def version_description\n VERSIONS[version]\n end", "def os_description\n return @os_description\n end", "def generate_description\n\t\t\tself.log.debug \"Auto-generating description for %p\" % [ self ]\n\t\t\tdesc = self.name.to_s.\n\t\t\t\tgsub( /.*\\[(\\w+)\\]/, \"\\\\1\" ).\n\t\t\t\tgsub( /_(.)/ ) {|m| \" \" + m[1,1].upcase }.\n\t\t\t\tgsub( /^(.)/ ) {|m| m.upcase }\n\t\t\tself.log.debug \" generated: %p\" % [ desc ]\n\t\t\treturn desc\n\t\tend", "def short_description\n \"#{self.actual_type}-#{self.version}\"\n end", "def generate_windows_computer_name\n prefix = Time.new.to_f\n prefix = prefix.to_s.delete('.')\n prefix = prefix.to_i.to_s(32) # example timestamp 1482829740.3734238 -> 'd5e883lv66u'\n suffix = Process.pid.to_s(32) # default max pid 65536, .to_s(32) -> '2000'\n padding_length = WINDOWS_VM_NAME_LENGTH - prefix.length - suffix.length\n if padding_length >= 0\n prefix + ('0' * padding_length) + suffix\n else\n @logger.warn('Length of generated string is longer than expected, so it is truncated. It may be not unique.')\n (prefix + suffix)[prefix.length + suffix.length - WINDOWS_VM_NAME_LENGTH, prefix.length + suffix.length] # get tail\n end\n end", "def window_info_string\n \" Name: \" + name +\n \"\\n Title: \" + title +\n \"\\n Active: \" + active?.to_s +\n \"\\n ID: \" + id.to_s +\n \"\\n Type: \" + type.to_s +\n \"\\nOnScreen: \" + on_screen?.to_s +\n \"\\n Pos: x=\" + element.getRect().x.to_s + \", y=\" + element.getRect().y.to_s +\n \"\\n Size: width=\" + element.getRect().width.to_s + \", height=\" + element.getRect().height.to_s + \"\\n\"\n end", "def generate_windows_computer_name\n prefix = Time.now.to_f\n prefix = prefix.to_s.delete('.')\n prefix = prefix.to_i.to_s(32) # example timestamp 1482829740.3734238 -> 'd5e883lv66u'\n suffix = Process.pid.to_s(32) # default max pid 65536, .to_s(32) -> '2000'\n padding_length = WINDOWS_VM_NAME_LENGTH - prefix.length - suffix.length\n if padding_length >= 0\n prefix + '0'*padding_length + suffix\n else\n @logger.warn(\"Length of generated string is longer than expected, so it is truncated. It may be not unique.\")\n (prefix + suffix)[prefix.length + suffix.length - WINDOWS_VM_NAME_LENGTH, prefix.length + suffix.length] # get tail\n end\n end", "def description\n @description ||= 'Test Kitchen ec2-net-utils secondary ENI ' \\\n \"for #{instance.id}\"\n end", "def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\n end", "def program_desc(desc)\n @io.puts \"== #{@app.exe_name} - #{desc}\"\n @io.puts\n end", "def build_resource_description(name, text)\n description = split_description_values(text)\n\n # if we're on a package resource, depending on the OS we want to inject a warning / note that you can just use 'package' instead\n description << { \"notes_resource_based_on_package\" => true } if %w{apt_package bff_package dnf_package homebrew_package ips_package openbsd_package pacman_package portage_package smartos_package windows_package yum_package zypper_package pacman_package freebsd_package}.include?(name)\n\n description\n end", "def os_description=(value)\n @os_description = value\n end", "def version_description\n raise NotImplementedError\n end", "def generate_version_message()\n specifications = @input_tool_specifications\n output_help_message = \"#{specifications[\"name\"]} version #{specifications[\"version\"]}\"\n return output_help_message\n end", "def full_description(machine_spec, bootstrap_options)\n description = [\"creating machine #{machine_spec.name} on #{driver_url}\"]\n bootstrap_options.to_hash.each_pair do |key, value|\n if value.is_a?(Hash)\n temp_value = value.clone\n temp_value[:password] = '*********' if value.key?(:password)\n else\n temp_value = value\n end\n description << \" #{key}: #{temp_value.inspect}\"\n end\n description\n end", "def build_host_name\n if @platform.abs_resource_name\n @platform.abs_resource_name\n elsif @platform.vmpooler_template\n @platform.vmpooler_template\n else\n @platform.name\n end\n end", "def full_name\n if platform == Gem::Platform::RUBY || platform.nil?\n \"#{@name}-#{@version}\"\n else\n \"#{@name}-#{@version}-#{platform}\"\n end \n end", "def full_name\n if platform == Gem::Platform::RUBY or platform.nil? then\n \"#{name}-#{version}\".untaint\n else\n \"#{name}-#{version}-#{platform}\".untaint\n end\n end", "def design_name\n\n if 1 == 2 # self.part_number_id == 0\n design_name = self.prefix.pcb_mnemonic + self.number\n design_name += self.revision.name if self.revision && self.revision_id > 0\n \n case self.entry_type\n when 'dot_rev'\n design_name += self.numeric_revision.to_s if self.numeric_revision > 0\n when 'date_code'\n design_name += self.numeric_revision.to_s if self.numeric_revision && self.numeric_revision > 0\n design_name += '_eco'\n design_name += self.eco_number\n end\n \n \"#{design_name} (\" + \n self.prefix.pcb_number(self.number,\n self.revision.name,\n self.numeric_revision) + ')'\n else\n self.pcb_number\n end\n \n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dump [1].xml from a Windows install image.
def get_xmlinfo def do_xmlget(imagepath) xmlinfo = %x{imagex info --xml #{imagepath}} @xmlinfo = REXML::Document.new xmlinfo return @xmlinfo end if defined?(@xmlinfo) then return @xmlinfo else @xmlinfo = nil end search = File.join(@path, 'sources/install.wim') wimage = Dir.glob(search, File::FNM_CASEFOLD) if wimage.length > 0 return do_xmlget(wimage.first) end search = File.join(@path, 'sources/boot.wim') bimage = Dir.glob(search, File::FNM_CASEFOLD) if bimage.length > 0 return do_xmlget(bimage.first) end @xmlinfo end
[ "def write_manifest_xml(path, properties)\n properties = { :xmlns => \"http://schemas.microsoft.com/deepzoom/2008\" }.merge properties\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n \"<Image TileSize=\\\"#{properties[:tile_size]}\\\" Overlap=\\\"#{properties[:tile_overlap]}\\\" \" +\n \"Format=\\\"#{properties[:tile_format]}\\\" xmlns=\\\"#{properties[:xmlns]}\\\">\" +\n \"<Size Width=\\\"#{properties[:width]}\\\" Height=\\\"#{properties[:height]}\\\"/>\" +\n \"</Image>\"\n\n open(path, \"w\") { |file| file.puts(xml) }\n end", "def package_file_elements\n [PACKAGE_NAME, 'windows', \"#{version}.windows\"]\n end", "def SaveInstallInf(root)\n if Stage.initial && !Mode.test\n inst_if_file = \"/etc/install.inf\"\n\n if root != nil && root != \"\" && root != \"/\"\n if WFM.Read(path(\".local.size\"), inst_if_file) != -1\n Builtins.y2milestone(\"Copying %1 to %2\", inst_if_file, root)\n if Convert.to_integer(\n WFM.Execute(\n path(\".local.bash\"),\n Builtins.sformat(\n \"grep -vi '^Sourcemounted' '%1' > %2/%1; chmod 0600 %2/%1\",\n inst_if_file,\n root\n )\n )\n ) != 0\n Builtins.y2error(\n \"Cannot SaveInstallInf %1 to %2\",\n inst_if_file,\n root\n )\n end\n else\n Builtins.y2error(\n \"Can't SaveInstallInf, file %1 doesn't exist\",\n inst_if_file\n )\n end\n else\n Builtins.y2error(\"Can't SaveInstallInf, root is %1\", root)\n end\n\n # just for debug so we can see the original install.inf later\n SCR.Execute(\n path(\".target.bash\"),\n Ops.add(\n Ops.add(\"/bin/cp /etc/install.inf \", root),\n \"/var/lib/YaST2/install.inf\"\n )\n )\n SCR.Execute(\n path(\".target.bash\"),\n Ops.add(\n Ops.add(\"/bin/chmod 0600 \", root),\n \"/var/lib/YaST2/install.inf\"\n )\n )\n end\n true\n end", "def dump\r\n File.open('encumber_gui.xml', 'w') {|f| f.write(@gui.dump) }\r\nend", "def installation_iptn args = nil\n args ||= {}\n\n element = REXML::Element.new 'sequence'\n\n element.attributes['name'] = args['name']\n element.attributes['ip'] = args['ip'].to_s.nil\n element.attributes['home'] = args['home']\n element.attributes['installation_home'] = args['installation_home']\n element.attributes['silencefile'] = args['silencefile']\n\n if args.has_key? 'license'\n element.attributes['license'] = args['license']\n end\n\n element.attributes['tmpdir'] = args['tmpdir'] || 'd:/installation_%s' % Time.now.timestamp_day\n\n if args.has_key? 'skip'\n element.attributes['skip'] = args['skip']\n end\n\n # 卸载网管\n\n cmdline_e = REXML::Element.new 'cmdline'\n\n cmdline_e.attributes['name'] = '${name}:卸载网管'\n cmdline_e.attributes['home'] = '${home}/ums-server'\n cmdline_e.attributes['cmdline'] = args['uninstall_cmdline'] || 'shutdown-console.bat'\n cmdline_e.attributes['callback_finish'] = 'netnumen_uninstall'\n cmdline_e.attributes['skipfail'] = true\n\n element << cmdline_e\n\n # 拷贝安装文件\n\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝安装文件'\n copy_e.attributes['path'] = args['installation_home']\n copy_e.attributes['to_path'] = '${tmpdir}'\n\n element << copy_e\n\n # 删除安装文件\n if args.has_key? 'deletes'\n delete_e = REXML::Element.new 'delete'\n\n delete_e.attributes['name'] = '${name}:删除安装文件'\n delete_e.attributes['path'] = File.join '${tmpdir}', args['deletes']\n delete_e.attributes['ensure'] = true\n delete_e.attributes['skipfail'] = true\n\n element << delete_e\n end\n\n # 拷贝补丁文件\n\n if args.has_key? 'installation_home_patch'\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝补丁文件'\n copy_e.attributes['path'] = args['installation_home_patch']\n copy_e.attributes['to_path'] = '${tmpdir}'\n\n element << copy_e\n end\n\n # 拷贝静默安装文件\n\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝静默安装文件'\n copy_e.attributes['path'] = args['silencefile']\n copy_e.attributes['to_path'] = '${tmpdir}/conf/silenceinstall-for-localhost.xml'\n copy_e.attributes['callback'] = 'netnumen_update_silenceinstall'\n\n copy_e.attributes['install_home'] = '${home}'\n copy_e.attributes['db'] = args['db'].to_s.nil\n\n if args.has_key? 'ems_locale'\n copy_e.attributes['ems_locale'] = args['ems_locale']\n end\n\n if args.has_key? 'client'\n copy_e.attributes['client'] = args['client']\n end\n\n if args.has_key? 'server'\n copy_e.attributes['server'] = args['server']\n end\n\n element << copy_e\n\n # 重启数据库\n if args['client'].to_s.boolean false\n function_e = REXML::Element.new 'function'\n\n function_e.attributes['name'] = '${name}:重启数据库'\n function_e.attributes['home'] = '${home}'\n function_e.attributes['db'] = args['db'].to_s.nil\n function_e.attributes['function'] = 'netnumen_database_restart'\n\n element << function_e\n end\n\n # 安装网管\n\n cmdline_e = REXML::Element.new 'cmdline'\n\n cmdline_e.attributes['name'] = '${name}:安装网管'\n cmdline_e.attributes['home'] = '${tmpdir}'\n cmdline_e.attributes['cmdline'] = args['cmdline'] || 'setup.bat d: silenceinstall-for-localhost.xml false'\n cmdline_e.attributes['callback_finish'] = 'netnumen_install'\n\n element << cmdline_e\n\n # 拷贝license\n\n if args.has_key? 'license'\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝license'\n copy_e.attributes['path'] = args['license']\n copy_e.attributes['to_path'] = '${home}/ums-server/works/main/deploy/ums-license.LCS'\n\n element << copy_e\n end\n\n # 清除临时文件\n\n delete_e = REXML::Element.new 'delete'\n\n delete_e.attributes['name'] = '${name}:清除临时安装文件'\n delete_e.attributes['path'] = '${tmpdir}/../install_tmp*'\n delete_e.attributes['ensure'] = true\n delete_e.attributes['skipfail'] = true\n\n element << delete_e\n\n delete_e = REXML::Element.new 'delete'\n\n delete_e.attributes['name'] = '${name}:清除临时文件'\n delete_e.attributes['path'] = '${tmpdir}'\n delete_e.attributes['ensure'] = true\n delete_e.attributes['skipfail'] = true\n\n element << delete_e\n\n element\n end", "def emitIzPackXML(xm)\n # raise \"xm must be an Builder::XmlMarkup object, but is #{xm.class}\" if xm.class != Builder::XmlMarkup\n xm.pack(@attributes) {\n xm.description(@description)\n @files.each{ |src, dest| xm.singlefile('src'=> src, 'target' =>dest) }\n }\n end", "def import_retina_xml_file(args={})\n filename = args[:filename]\n\n data = \"\"\n ::File.open(filename, 'rb') do |f|\n data = f.read(f.stat.size)\n end\n import_retina_xml(args.merge(:data => data))\n end", "def dump_xml(io)\n io.puts \"<project name=\\\"imported-configuration-settings\\\">\"\n io.puts(@xmlstuff.join(\"\\n\"))\n io.puts \"</project>\"\n end", "def fits_xml_out(xml, collection_id) \n\n file_out(collection_id, \".fits.xml\", xml)\n \n\nend", "def build_information_file\n dir = FilePath.new(@build_dir, \"cruisecontrol_integrated_xml_files\").ensure_directory\n FilePath.new(dir, \"build-information.xml\")\n end", "def installer\n @installer ||= File.join(mount_point, 'VBoxWindowsAdditions.exe')\n end", "def to_mzXML\n puts \"\\n--------------------------------\" # These puts statements at the begining of each class is my way of showing the progress of the program to the user.\n puts \"Transforming raw file to mzXML format...\\n\\n\"\n \n options = config_value(\"//ReAdW/@commandLine\")\n basename = File.basename(@file).chomp(File.extname(@file))\n system(\"wine readw.exe #{options} --mzXML #{@file} #{$path}../data/spectra/#{basename}.mzXML 2>/dev/null\")\n end", "def exe_creator_uw_append_wtdall(filewrap)\r\n ef = \"\"\r\n File.open(\"unwrapper.exe\", \"rb\") {|uf| ef << uf.read}\r\n ef << filewrap.to_s\r\n ef\r\nend", "def installation_sptn args = nil\n args ||= {}\n\n element = REXML::Element.new 'sequence'\n\n element.attributes['name'] = args['name']\n element.attributes['ip'] = args['ip'].to_s.nil\n element.attributes['home'] = args['home']\n element.attributes['installation_home'] = args['installation_home']\n element.attributes['silencefile'] = args['silencefile']\n\n if args.has_key? 'license'\n element.attributes['license'] = args['license']\n end\n\n element.attributes['tmpdir'] = args['tmpdir'] || 'd:/installation_%s' % Time.now.timestamp_day\n\n if args.has_key? 'skip'\n element.attributes['skip'] = args['skip']\n end\n\n # 卸载控制器\n\n cmdline_e = REXML::Element.new 'cmdline'\n\n cmdline_e.attributes['name'] = '${name}:卸载控制器'\n cmdline_e.attributes['home'] = '${home}/ums-server'\n cmdline_e.attributes['cmdline'] = args['uninstall_cmdline'] || 'shutdown-console.bat'\n cmdline_e.attributes['callback_finish'] = 'netnumen_uninstall'\n cmdline_e.attributes['skipfail'] = true\n\n element << cmdline_e\n\n # 拷贝安装文件\n\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝安装文件'\n copy_e.attributes['path'] = args['installation_home']\n copy_e.attributes['to_path'] = '${tmpdir}'\n\n element << copy_e\n\n # 拷贝补丁文件\n\n if args.has_key? 'installation_home_patch'\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝补丁文件'\n copy_e.attributes['path'] = args['installation_home_patch']\n copy_e.attributes['to_path'] = '${tmpdir}'\n\n element << copy_e\n end\n\n # 拷贝静默安装文件\n\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝静默安装文件'\n copy_e.attributes['path'] = args['silencefile']\n copy_e.attributes['to_path'] = '${tmpdir}/conf/silenceinstall-for-localhost.xml'\n copy_e.attributes['callback'] = 'netnumen_update_silenceinstall'\n\n copy_e.attributes['install_home'] = '${home}'\n copy_e.attributes['db'] = args['db'].to_s.nil\n\n if args.has_key? 'ems_locale'\n copy_e.attributes['ems_locale'] = args['ems_locale']\n end\n\n copy_e.attributes['server'] = true\n\n element << copy_e\n\n # 重启数据库\n\n function_e = REXML::Element.new 'function'\n\n function_e.attributes['name'] = '${name}:重启数据库'\n function_e.attributes['home'] = '${home}'\n function_e.attributes['db'] = args['db'].to_s.nil\n function_e.attributes['function'] = 'netnumen_database_restart'\n\n element << function_e\n\n # 安装控制器\n\n cmdline_e = REXML::Element.new 'cmdline'\n\n cmdline_e.attributes['name'] = '${name}:安装控制器'\n cmdline_e.attributes['home'] = '${tmpdir}'\n cmdline_e.attributes['cmdline'] = args['cmdline'] || 'setup.bat d: silenceinstall-for-localhost.xml false'\n cmdline_e.attributes['callback_finish'] = 'netnumen_install'\n\n element << cmdline_e\n\n # 拷贝license\n\n if args.has_key? 'license'\n copy_e = REXML::Element.new 'copy'\n\n copy_e.attributes['name'] = '${name}:拷贝license'\n copy_e.attributes['path'] = '${license}'\n copy_e.attributes['to_path'] = '${home}/ums-server/works/main/deploy/ums-license.LCS'\n\n element << copy_e\n end\n\n # 配置控制器\n\n function_e = REXML::Element.new 'function'\n\n function_e.attributes['name'] = '${name}:控制器'\n function_e.attributes['home'] = '${home}'\n function_e.attributes['function'] = 'netnumen_sptn_settings'\n\n if args.has_key? 'main_ip'\n function_e.attributes['main_ip'] = args['main_ip']\n end\n\n element << function_e\n\n # 清除临时文件\n\n delete_e = REXML::Element.new 'delete'\n\n delete_e.attributes['name'] = '${name}:清除临时安装文件'\n delete_e.attributes['path'] = '${tmpdir}/../install_tmp*'\n delete_e.attributes['ensure'] = true\n delete_e.attributes['skipfail'] = true\n\n element << delete_e\n\n delete_e = REXML::Element.new 'delete'\n\n delete_e.attributes['name'] = '${name}:清除临时文件'\n delete_e.attributes['path'] = '${tmpdir}'\n delete_e.attributes['ensure'] = true\n delete_e.attributes['skipfail'] = true\n\n element << delete_e\n\n element\n end", "def to_zapp_xml\n results = submit_cmd('',:dump,\"-env #{self.env} --zappdb --outdir .\")\n puts results\n end", "def xmlinstall\n\n\t\tif !File.exists?(resource[:xml_file])\n\t\t\tdebug \"Creating the XML file: %s \" % resource[:xml_file]\n\n\t\t\tcase resource[:virt_type]\n\t\t\t\twhen :openvz then\n\t\t\t\t\tdebug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\ttmplcache = resource[:tmpl_cache]\n\t\t\t\t\txargs = \"-c openvz:///system define --file \"\n\t\t\t\t\tif !tmplcache.nil?\n\t\t\t\t\t\trequire \"erb\"\n\t\t\t\t\t\txmlovz = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/ovz_xml.erb\")\n\t\t\t\t\t\txmlovz.puts = xmlwrite.result\n\t\t\t\t\t\txmlovz.close\n\t\t\t\t\telse\n\t\t\t\t\t\tfail(\"OpenVZ Error: No template cache define!\")\n\t\t\t\t\tend\n\t\t\t\telse debug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\txargs = \"-c qemu:///session define --file \"\n\t\t\t\t\trequire \"erb\"\n\t\t\t\t\txmlqemu = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/qemu_xml.erb\")\n\t\t\t\t\txmlqemu.puts = xmlwrite.result\n\t\t\t\t\txmlqemu.close\n\t\t\t\tend\n\t\n\t\t\tdebug \"Creating the domain: %s \" % [resource[:name]]\n\t\t\tvirsh xargs + resource[:xml_file]\n\t\telse\n\t\t\tfail(\"Error: XML already exists on disk \" + resource[:xml_file] + \".\" )\t\n\t\tend\n\tend", "def writeInformation(fileName)\n Nmap::XML.new('scan.xml') do |xml|\n xml.each_host do |host|\n File.open(fileName, \"a\") do |line|\n if(host.status.to_s == \"down\")\n line.puts \"[#{host.ip}] is down\\n\\n\"\n next\n end\n line.puts \"[#{host.ip}]\"\n host.each_port do |port|\n line.puts \" #{port.number}/#{port.protocol}\\t#{port.state}\\t#{port.service}\"\n end\n if(@osFingerprint)\n line.puts \"#{host.os.matches[0]}\"\n end\n line.puts \"\\n\"\n end\n end\n end\n end", "def save\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--edit\", \"--network\", \"mac=#{@mac}\"])\n Cheetah.run([\"sudo\", \"virt-xml\", name, \"--edit\", \"--boot\", @boot_order.join(\",\")])\n read_definition\n end", "def save_conf_process_xml_file\n @conf_process_xml_file.tap do |f|\n open(f, 'w:UTF-8') do |o|\n o.print conf_process_xml\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
localhost:3000/addresses/5/edit http method :GET pathedit_address_path roles and responsibilities
def edit @address=Address.new @address=Address.find(params[:id]) end
[ "def edit\n\t\t@address = current_user.addresses.find(params[:id])\n\tend", "def edit\r\n @address = Address.find(params[:id])\r\n end", "def edit\n @user = User.find(params[:id])\n #@form_submit_url = update_customer_path\n #render \"user_addresses/edit\"\n end", "def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_address\n traveller = Traveller.find(params[:pk])\n address = params[:value]\n\n coordinates = GoogleAPIGeocoder.do_geocode(address)\n\n if coordinates.nil?\n render json: {success: false, msg: 'Unable to find the location of the given address. Please check that it is correct.'}\n else\n traveller.update(address: address, latitude: coordinates[0], longitude: coordinates[1])\n\n if current_user.nil?\n if session[:trip] != nil\n travellers = session[:trip].travellers\n travellers[travellers.index(traveller)].address = params[:value]\n end\n\n if session[:travellers] != nil\n session[:travellers][session[:travellers].index(traveller)].address = params[:value]\n end\n end\n\n render json: {success: true}\n end\n end", "def edit_address(order_or_user, address_id, expect_success, values, type=nil)\n visit_edit_address(order_or_user, address_id)\n fill_in_address(values, type)\n click_button Spree.t('actions.update')\n\n if expect_success\n expect_address_collection_path(order_or_user)\n expect(page).to have_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n else\n expect(page).to have_no_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n expect(path_with_query).to eq(spree.admin_address_path(address_id, user_id: @user_id, order_id: @order_id))\n end\n end", "def update\n @address = current_user.addresses.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_address_in_place\n if request.xml_http_request?\n begin\n @address = Address.find( params[:id] )\n case params[:type].to_s.to_sym\n when :save\n # saving changes\n @address.attributes = params[@address.kind]\n @address.save!\n render :partial => 'shared/profile_address_in_place', :locals => { :address => @address, :update => true, :editable => true }\n when :edit\n # swithcing to edit mode\n render :partial => 'shared/profile_address_in_place', :locals => { :address => @address, :update => true, :edit => true }\n end\n rescue ActiveRecord::RecordInvalid => ex\n render :text => form_error_messages_for(:address), :status => 444\n rescue Exception => ex\n flash[:error] = \"There were unexpected errors.\".t\n render :text => form_flash_messages, :status => 444\n end\n end\n end", "def edit\n __debug_route\n @item = edit_record\n manifest_item_authorize!\n rescue => error\n failure_status(error)\n end", "def visit_edit_address(order_or_user, address, direct=false)\n address = address.id if address.is_a?(Spree::Address)\n\n if direct\n order_id = order_or_user.is_a?(Spree::Order) ? order_or_user.id : nil\n user_id = order_or_user.is_a?(Spree::User) ? order_or_user.id : order_or_user.user_id\n visit spree.edit_admin_address_path(address, order_id: order_id, user_id: user_id)\n else\n visit_addresses(order_or_user)\n click_link \"edit-address-#{address}\"\n end\n\n expect(current_path).to eq(spree.edit_admin_address_path(address))\n end", "def edit\n logger.debug(\"Role edit\")\n @role = Role.find(params[:id])\n @person = @role.person\n end", "def edit_address(edited_address)\n address = Address.find(edited_address.uid)\n address.attributes = edited_address.attributes\n address.save!\n end", "def edit\n respond_with(reagent)\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: api_v1_addresses_url(@address) }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_frontend_address(user, address, expect_success, values, default_bill=nil, default_ship=nil)\n address = address.id if address.is_a?(Spree::Address)\n\n visit spree.account_path\n if address\n click_link \"edit_address_#{address}\"\n expect(current_path).to eq(spree.edit_address_path(address))\n else\n within('#addresses > tbody > tr:first-child') do\n click_link Spree.t(:edit)\n end\n end\n\n fill_in_address(values)\n check_frontend_defaults(default_bill, default_ship)\n\n click_button Spree.t(:update)\n\n if expect_success\n expect(page).to have_content(Spree.t(:successfully_updated, :resource => Spree.t(:address1)))\n expect(current_path).to eq(spree.account_path)\n expect_frontend_addresses(user)\n else\n expect(page).to have_no_content(Spree.t(:successfully_updated, :resource => Spree.t(:address1)))\n end\n end", "def update\n @residential_address = ResidentialAddress.find(params[:id])\n\n respond_to do |format|\n if @residential_address.update_attributes(params[:residential_address])\n format.html { redirect_to polymorphic_path([@client, :residential_addresses], load_style: :partial), notice: 'Residential address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @residential_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_address\n @address = Spree::Address.where(id: params[:address][:id]).first\n @address.update_attributes(address_params_list) if @address.present?\n @user = current_user\n end", "def edit_url\n self.url + \"/edit\"\n end", "def edit\n @person = Person.find(params[:id])\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
EPIC TWEET GEN takes a user hashtag and how many tweets to gen returns the total rating
def generate_tweets(hashtag, how_many) total_stars = 0 how_many.times do stars = rand(5)+1 total_stars += stars Tweet.create( user_handle: Faker::Lorem.words(2).join('_'), user_display: Faker::Name.name, feedback: Faker::Lorem.sentences(2).join << " #{stars}star #doha ##{hashtag} #dmkr", rating: stars, event_hashtag: 'doha', participant_hashtag: "#{hashtag}", timestamp: rand(24.hours).ago ) end total_stars end
[ "def tweet_score(favorite_count, retweet_count)\n return favorite_count + (retweet_count * 2)\n end", "def total_tweets(user)\n total_tweets = TwitterAccount.find_by(user_id: user.id).total_num_tweets\n total_tweets\n end", "def tweet(user)\n length = rand(1..140)\n text = words.shuffle.join(' ')[0..length]\n source = %w[web TweetDeck Tweetbot Twitterific Echofon API].sample\n user.tweet(text, source)\n end", "def analyze_tweets(tweets)\n\t\t@tweets = tweets\n\t\t@totalsentiment = 0\n @totaltweets = 0;\n \t@tweetsinfo = []\n \t\t@tweets.each do |t|\n @totaltweets+=1;\n \t\t\ttsentiment = get_sentiment(t.text).to_s\n \t\t\tif tsentiment == 'positive'\n \t\t\t\t@totalsentiment-=1\n \t\t\telsif tsentiment == 'negative'\n \t\t\t\t@totalsentiment+=1\n \t\t\tend\n \t\t\tformattedTime = t.created_at.strftime(\"%m/%d/%Y %H:%M\")\n \t\t\t@tweetsinfo.push(text: t.text, created_at: formattedTime, sentiment: tsentiment)\n \t\tend\n @sentimentnormalized = @totalsentiment*50/@totaltweets;\n \t@info = {totalsentiment: @sentimentnormalized , tweets: @tweetsinfo}\n\tend", "def calculate_favorite_tweeter\n # Count each fav as 1 point\n scores = Hash[most_faved]\n scores.default = 0\n\n # Count each RT as 1.5 points\n most_retweeted.each { |screen_name, rts| scores[screen_name] += (rts * 1.5) }\n\n winning_screen_name, winning_score = scores.max_by { |_, score| score }\n\n {\n :screen_name => winning_screen_name,\n :favs_count => Hash[most_faved][winning_screen_name],\n :retweets_count => Hash[most_retweeted][winning_screen_name],\n :score => winning_score\n }\n end", "def getHashtags( num_hashtags = nil )\n \n\n debug \"selecting for hashtags\"\n if !num_hashtags\n #oh boy, grab every single hashtag\n data = @db['users'].find( {}, {:fields => {'tweets.hashtags' => 1, '_id' => 0} })\n else\n #just grab enough users so that we can get a good crop of hashtags\n rseed = rand()\n data = @db['users'].find( { 'random' => { '$gte' => rseed } }, {:fields => {'tweets.hashtags' => 1, '_id' => 0} }).limit( num_hashtags * 10 )\n end\n \n #turn user data response into array of hashtags\n if !num_hashtags\n #ALL the hashtags\n hashtags = data.to_a.collect{ |u| u['tweets'].collect{|t| t['hashtags']} }.flatten(2)\n else\n #nah just sum\n hashtags = []\n data = data.to_a\n while ( hashtags.length < num_hashtags )\n x = data.sample['tweets'].sample['hashtags'].sample rescue nil\n hashtags << x if !x.nil? && x != ''\n end\n end\n \n #return our hashtags\n hashtags\n end", "def count_tweets(username)\n\n # fetch all the tweets for this user,\n # set tweets count to max 200\n fetched_tweets = @client.user_timeline(username, {count: 200})\n\n # init a counter to keep the count of tweet happens in last 24 hours\n hour_counter = Array.new(24) { |e| e = 0 }\n\n # start the timer after fetch all the tweets\n now = Time.now\n fetched_tweets.each do |tweet|\n if now < tweet.created_at + 24 * 60 * 60\n # only consider the 24 hours tweets\n hour_counter[tweet.created_at.hour] += 1\n else\n # if loop to a tweet before 24 hours ago,\n # then terminates the loop\n break\n end\n end\n\n # convert array into hash\n # using array index as key\n # and convert key to string\n hash = Hash.new\n hour_counter.each_with_index {|val, index| hash[index.to_s] = val}\n return hash\n end", "def rating(username)\n end", "def popular\n # view key is [user_id, tweet_id]\n view = Favorite.by_author_id.startkey([id, nil]).endkey([id, 'ZZZZZZZ'])\n\n # query reduce view to get star counts\n stars = Hash[view.reduce.group.rows.map do |row|\n # key=[user_id, tweet_id], value=stars\n [row['key'][1], row['value']]\n end]\n\n view.reset!\n\n # query view again for tweet docs\n view.all.each do |tweet|\n tweet.stars = stars[tweet.id]\n end.sort_by {|tweet| -tweet.stars }\n end", "def feeds_with_top_tweets\n\n end", "def get_sample_user_tweets\r\n [\r\n \"don't ever change\",\r\n \"A long-term goal of mine is to create a water-based horror game. I've done some work on building this in Unity already.\",\r\n \"Many amazing looking animals can be kept in reasonably simple environments, but some require elaborate setups .\",\r\n \"I enjoy creating terrariums but it's a lot of work to keep everything balanced so that all the critters survive .\",\r\n \"Although I haven't had a cat myself, I have had aquariums, terrariums, and rodents at different points .\",\r\n \"i have personally never owned a pet cat, and I'm a bit allergic, but I still enjoy their company .\",\r\n \"carnivorous by nature, cats hunt many other wild animals such as gophers and mice. As a result, some people would prefer less outdoor cats .\",\r\n \"you have now unsubscribed to cat facts. respond with UNSUBSCRIBE to unsubscribe .\",\r\n \"egyption hairless cats are less allergenic than most other cats. they don't have hair and are probably less oily .\",\r\n \"the cat in the hat ate and sat. it got fat and couldn't catch a rat .\"\r\n ]\r\n end", "def find_tweets\n @topics = Topic.all.limit(5).pluck(:name).join(\" OR \")\n @quantity = Favorite.first.quantity\n @client = create_client\n response = @client.search(@topics, result_type: \"recent\").to_a\n @quantity.times{create_favorite_tweet response[Random.rand(response.length)] }\n check_new_followers\n end", "def retwitted_from\n tweets = Tweet.all.where(tweet_id: self.id).distinct.count(:user_rt)\n end", "def calculate_score\n rating = (average_rating(\"overall\") +\n average_rating(\"documentation\")) / 2\n score = (rating / 5) * 100\n\n if package_users.count > 0\n score = score + (100 - score) *\n (1 - Math.exp(-package_users_count / 100.to_f))\n end\n\n score\n end", "def parse_user_tweets(response)\n maxID = nil #variable to store the maxID of the current request, will be used to requery to get the next list of tweets on user's timeline\n tweetCount = 0 #variable to store the total number of tweets in this response\n retweetCount = 0 #variable to store the total number of retweets in this response\n \n # Check for a successful request\n if response.code == '200'\n # Parse the response body, which is in JSON format.\n tweets = JSON.parse(response.body)\n\n # For each tweet, check the timestamp to make sure we're only including the data from the past 7 days then increase count as needed\n tweets.each do |tweet|\n if DateTime.parse(tweet[\"created_at\"]) > DateTime.now-7\n \n # Tweet is from the past 7 days, increase count\n tweetCount += 1\n \n maxID = tweet[\"id\"]-1 # Subtract 1 before storing maxID so the next request won't include duplicate\n \n # Check if tweet contains retweeted_status info\n if tweet[\"retweeted_status\"] != nil\n # Increase count if tweet is verified as a retweet\n retweetCount += 1\n end\n end\n end\n \n # Return result as an array of maxID, count of number of tweets, and count of number of retweets\n return [maxID, tweetCount, retweetCount]\n else\n # There was an error issuing the request.\n puts 'Expected a response of 200 but got #{response.code} instead'\n end\nend", "def score(username)\n user = get(\"/v2/identity.json/twitter\", :screenName => username)\n puts user.inspect\n get(\"/v2/user.json/#{user[\"id\"]}/score\")\n end", "def process_tweets(tweets)\n puts \"Total tweets #{tweets.size}\"\n tweets.each { |tweet|\n words = tweet.split\n words.each { |word|\n @words_hash[word] += 1 unless IGNORE_WORDS_LIST.include?(word.downcase)\n }\n }\n end", "def seed_tweets\n user = User.first\n user_id = user.id\n tweets_per_user = 0\n row_num = 1\n CSV.foreach('./seed_data/tweets.csv') do |row|\n if row_num != row[0].to_i\n increase = row[0].to_i - row_num\n tweets_per_user = 0\n user_id += increase\n row_num = row[0].to_i\n user = User.find(user_id)\n elsif tweets_per_user < 5\n t = Tweet.create(author_id: user_id, author_name: user[:name], text: row[1], created_at: row[2])\n t.save\n user.increment_tweets\n tweet = [user[:name], row[1], row[2], t.id]\n RedisClass.cache_tweet(tweet, user_id,t.id)\n tweets_per_user += 1\n end\n end\n\n # if tweet_count >= 8000\n # break\n # else\n # if row[0].to_i + start_index != user.id\n # user = User.find(row[0].to_i + start_index)\n # end\n # t = Tweet.create(author_id: user.id, author_name: user[:name], text: row[1], created_at: row[2])\n # user.increment_tweets\n # user.save\n # tweet_count += 1\n # end\n # end\nend", "def process_tweets\n tweet_timeline = $client.mentions_timeline\n \n @tweet_timeline.each do |tweet|\n tweet.user.screen_name\n tweet.text\n end\n\n #get user and information supplied, then reply to the tweeter\n #tweet = $client.update(\"#{}\")\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /empleadobitacoras/1 GET /empleadobitacoras/1.xml
def show @empleadobitacora = Empleadobitacora.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @empleadobitacora } end end
[ "def show\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end", "def show\n @empleadostipo = Empleadostipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empleadostipo }\n end\n end", "def show\n\n @puntuacione = Puntuacione.find(params[:id])\n respond_to do |format| \n format.xml { render xml: @puntuacione }\n end\n end", "def show\n @atendimento_aee = AtendimentoAee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atendimento_aee }\n end\n end", "def index\n @asesorias = usuario_actual.profesor.asesorias.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @asesorias }\n end\n end", "def show\n @orc_empenho_iten = OrcEmpenhoIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_empenho_iten }\n end\n end", "def show\n @etapasproceso = Etapasproceso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @etapasproceso }\n end\n end", "def show\n @empresa = Empresa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empresa }\n end\n end", "def index\n @jido_edu_rels = JidoEduRel.find(:all)\n@shidou_recs = ShidouRec.find(:all)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_edu_rels }\n end\n end", "def index\n @offres = Offre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offres }\n end\n end", "def index\n @eads = Ead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eads }\n end\n end", "def index\n @employee_remunerative_concepts = @employee.employee_remunerative_concept.all\n\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @employee_remunerative_concepts }\n end\n end", "def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end", "def show\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def show\n @eep = Eep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @eep }\n end\n end", "def show\n @exemplo = Exemplo.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exemplo }\n end\n end", "def show\n @estagiarios = Estagiario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def index\n @detalle_recibo_habers = @recibo_sueldo.detalle_recibo_habers.all\n\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @detalle_recibo_habers }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /empleadobitacoras/new GET /empleadobitacoras/new.xml
def new @empleadobitacora = Empleadobitacora.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @empleadobitacora } end end
[ "def new\n @empleadosautorizado = Empleadosautorizado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end", "def new\n @empleadostipo = Empleadostipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadostipo }\n end\n end", "def new\n @empresa = Empresa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empresa }\n end\n end", "def new\n @etapasproceso = Etapasproceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @etapasproceso }\n end\n end", "def new\n @entrega = Entrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrega }\n end\n end", "def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end", "def new\n @orc_empenho = OrcEmpenho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @orc_empenho }\n end\n end", "def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def new\n\t\t@empleado = Empleado.new\n\t\t@query = Persona.find(:all)\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @empleado }\n\t\tend\n\tend", "def new\n @era = Era.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @era }\n end\n end", "def new\n @obrasproyecto = Obrasproyecto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @obrasproyecto }\n end\n end", "def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end", "def new\n @ausencia = Ausencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ausencia }\n end\n end", "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end", "def new\n @aetapa = Aetapa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aetapa }\n end\n end", "def new\n @espacio = Espacio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @espacio }\n end\n end", "def new\n @emp = Emp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @emp }\n end\n end", "def new\n @exemplo = Exemplo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exemplo }\n end\n end", "def new\n @acceso = Acceso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acceso }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /empleadobitacoras POST /empleadobitacoras.xml
def create @empleadobitacora = Empleadobitacora.new(params[:empleadobitacora]) respond_to do |format| if @empleadobitacora.save format.html { redirect_to(@empleadobitacora, :notice => 'Empleadobitacora was successfully created.') } format.xml { render :xml => @empleadobitacora, :status => :created, :location => @empleadobitacora } else format.html { render :action => "new" } format.xml { render :xml => @empleadobitacora.errors, :status => :unprocessable_entity } end end end
[ "def create\n @etapasproceso = Etapasproceso.new(params[:etapasproceso])\n\n respond_to do |format|\n if @etapasproceso.save\n flash[:notice] = 'Etapasproceso was successfully created.'\n format.html { redirect_to(@etapasproceso) }\n format.xml { render :xml => @etapasproceso, :status => :created, :location => @etapasproceso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @etapasproceso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empleadostipo = Empleadostipo.new(params[:empleadostipo])\n\n respond_to do |format|\n if @empleadostipo.save\n format.html { redirect_to(@empleadostipo, :notice => 'Empleadostipo was successfully created.') }\n format.xml { render :xml => @empleadostipo, :status => :created, :location => @empleadostipo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empleadostipo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empleadosautorizado = Empleadosautorizado.new(params[:empleadosautorizado])\n\n respond_to do |format|\n if @empleadosautorizado.save\n format.html { redirect_to(@empleadosautorizado, :notice => 'Empleadosautorizado was successfully created.') }\n format.xml { render :xml => @empleadosautorizado, :status => :created, :location => @empleadosautorizado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empleadosautorizado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @orc_empenho_iten = OrcEmpenhoIten.new(params[:orc_empenho_iten])\n\n respond_to do |format|\n if @orc_empenho_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_empenho_iten) }\n format.xml { render :xml => @orc_empenho_iten, :status => :created, :location => @orc_empenho_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_empenho_iten.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@empleado = Empleado.new(params[:empleado])\n\n\t\trespond_to do |format|\n\t\t\tif @empleado.save\n\t\t\t NUESTRO_LOG.info \"Se guardo el empleado correctamente\"\n\t\t\t\tformat.html { redirect_to(@empleado, :notice => t('empleadocreado')) }\n\t\t\t\tformat.xml { render :xml => @empleado, :status => :created, :location => @empleado }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @empleado.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @expedicao = Expedicao.new(params[:expedicao])\n\n respond_to do |format|\n if @expedicao.save\n flash[:notice] = 'Expedicao was successfully created.'\n format.html { redirect_to(@expedicao) }\n format.xml { render :xml => @expedicao, :status => :created, :location => @expedicao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expedicao.errors, :status => :unprocessable_entity }\n end\n end\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 create\n @entradas = Entrada.new(params[:entrada])\n\n respond_to do |format|\n if @entradas.save\n flash[:notice] = 'LANÇAMENTO ENTRADA EFETUADO'\n format.html { redirect_to(homes_path) }\n format.xml { render :xml => @entradas, :status => :created, :location => @entradas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entradas.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @empleadobitacora = Empleadobitacora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadobitacora }\n end\n end", "def create\n @estagio = Estagio.new(params[:estagio])\n\n respond_to do |format|\n if @estagio.save\n flash[:notice] = 'Estagio was successfully created.'\n format.html { redirect_to(@estagio) }\n format.xml { render :xml => @estagio, :status => :created, :location => @estagio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_expense_xml(xml)\n #request header bekommt Content-type = xml\n header \"Content-Type\", \"text/xml\" \n #expense daten werden alsl xml per Post request an den Server gesendet\n post '/expenses', xml\n #es wird erwartet das dies erfolgreich war\n expect(last_response.status).to eq(200)\n\n parsed = Ox.load(last_response.body, mode: :hash)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n #adds an id key to the expense hash, containing the id from the database, after an expense is succesfully stored\n expense.merge('id' => parsed['expense_id'])\nend", "def create\n @cabo_eleitoral = CaboEleitoral.new(params[:cabo_eleitoral])\n @cabo_eleitoral.pessoa = Pessoa.new(params[:pessoa]) \n \n respond_to do |format|\n if @cabo_eleitoral.save\n format.html { redirect_to(@cabo_eleitoral, :notice => ' - Cabo eleitoral cadastrado com sucesso.') }\n format.xml { render :xml => @cabo_eleitoral, :status => :created, :location => @cabo_eleitoral }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cabo_eleitoral.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @agenciaextranjera = Agenciaextranjera.new(params[:agenciaextranjera])\n\n respond_to do |format|\n if @agenciaextranjera.save\n format.html { redirect_to(@agenciaextranjera, :notice => 'Agencia Extranjera fue creada satisfactoriamente.') }\n format.xml { render :xml => @agenciaextranjera, :status => :created, :location => @agenciaextranjera }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @agenciaextranjera.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @orc_ata_iten = OrcAtaIten.new(params[:orc_ata_iten])\n\n respond_to do |format|\n if @orc_ata_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_ata_iten) }\n format.xml { render :xml => @orc_ata_iten, :status => :created, :location => @orc_ata_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_ata_iten.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @empresa_formapagto = EmpresaFormapagto.new(params[:empresa_formapagto])\n\n respond_to do |format|\n if @empresa_formapagto.save\n flash[:notice] = 'EmpresaFormapagto was successfully created.'\n format.html { redirect_to(@empresa_formapagto) }\n format.xml { render :xml => @empresa_formapagto, :status => :created, :location => @empresa_formapagto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @empresa_formapagto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @almacenescierre = Almacenescierre.new(params[:almacenescierre])\n\n respond_to do |format|\n if @almacenescierre.save\n flash[:notice] = 'Almacenescierre was successfully created.'\n format.html { redirect_to(@almacenescierre) }\n format.xml { render :xml => @almacenescierre, :status => :created, :location => @almacenescierre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @almacenescierre.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @adjunto = Adjunto.new(params[:adjunto])\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to(@adjunto, :notice => 'Adjunto was successfully created.') }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjunto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @espacio = Espacio.new(params[:espacio])\n\n respond_to do |format|\n if @espacio.save\n flash[:notice] = 'Se creo el espacio satisfactoriamente.'\n format.html { redirect_to(@espacio) }\n format.xml { render :xml => @espacio, :status => :created, :location => @espacio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @espacio.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /empleadobitacoras/1 PUT /empleadobitacoras/1.xml
def update @empleadobitacora = Empleadobitacora.find(params[:id]) respond_to do |format| if @empleadobitacora.update_attributes(params[:empleadobitacora]) format.html { redirect_to(@empleadobitacora, :notice => 'Empleadobitacora was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @empleadobitacora.errors, :status => :unprocessable_entity } end end end
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "def update\n @etapasproceso = Etapasproceso.find(params[:id])\n\n respond_to do |format|\n if @etapasproceso.update_attributes(params[:etapasproceso])\n flash[:notice] = 'Etapasproceso was successfully updated.'\n format.html { redirect_to(@etapasproceso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @etapasproceso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_osexterna = TipoOsexterna.find(params[:id])\n\n respond_to do |format|\n if @tipo_osexterna.update_attributes(params[:tipo_osexterna])\n flash[:notice] = 'ATUALIZADO COM SUCESSO.'\n format.html { redirect_to(@tipo_osexterna) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_osexterna.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @atendimento_aee = AtendimentoAee.find(params[:id])\n\n respond_to do |format|\n if @atendimento_aee.update_attributes(params[:atendimento_aee])\n flash[:notice] = 'AtendimentoAee was successfully updated.'\n format.html { redirect_to(@atendimento_aee) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atendimento_aee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @exemplo = Exemplo.find(params[:id])\n\n respond_to do |format|\n if @exemplo.update_attributes(params[:exemplo])\n flash[:notice] = 'Exemplo was successfully updated.'\n format.html { redirect_to(@exemplo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exemplo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n\n respond_to do |format|\n if @empleadosautorizado.update_attributes(params[:empleadosautorizado])\n format.html { redirect_to(@empleadosautorizado, :notice => 'Empleadosautorizado was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @empleadosautorizado.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @espacio = Espacio.find(params[:id])\n\n respond_to do |format|\n if @espacio.update_attributes(params[:espacio])\n flash[:notice] = 'Espacio actualizado correctamente.'\n format.html { redirect_to(@espacio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @espacio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estagiario = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiario.update_attributes(params[:estagiario])\n flash[:notice] = 'Estagiario foi atualizado com sucesso.'\n format.html { redirect_to(@estagiario) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @emp = Emp.find(params[:id])\n\n respond_to do |format|\n if @emp.update_attributes(params[:emp])\n format.html { redirect_to(@emp, :notice => 'Emp was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @emp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @supervisor_estagio = SupervisorEstagio.find(params[:id])\n\n respond_to do |format|\n if @supervisor_estagio.update_attributes(params[:supervisor_estagio])\n flash[:notice] = 'Supervisor de Estagio atualizado com sucesso.'\n format.html { redirect_to(@supervisor_estagio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @supervisor_estagio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n \n \n format.xml \n else\n \n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n if @oase.update_attributes(params[:oase])\n format.html { redirect_to @oase, notice: 'Oasis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orc_suplementacao = OrcSuplementacao.find(params[:id])\n\n respond_to do |format|\n if @orc_suplementacao.update_attributes(params[:orc_suplementacao])\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_suplementacao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @orc_suplementacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @objeto = Objeto.find(params[:id])\n\n respond_to do |format|\n if @objeto.update_attributes(params[:objeto])\n flash[:notice] = 'Objeto was successfully updated.'\n format.html { redirect_to(@objeto) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @objeto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ayudastiposevento = Ayudastiposevento.find(params[:id])\n\n respond_to do |format|\n if @ayudastiposevento.update_attributes(params[:ayudastiposevento])\n flash[:notice] = 'Ayudastiposevento was successfully updated.'\n format.html { redirect_to(@ayudastiposevento) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ayudastiposevento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @administracao_tarefa = Administracao::Tarefa.find(params[:id])\n\n respond_to do |format|\n if @administracao_tarefa.update_attributes(params[:administracao_tarefa])\n format.html { redirect_to(@administracao_tarefa, :notice => 'Tarefa atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @administracao_tarefa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @obrasproyecto = Obrasproyecto.find(params[:id])\n\n respond_to do |format|\n if @obrasproyecto.update_attributes(params[:obrasproyecto])\n flash[:notice] = 'Obrasproyecto was successfully updated.'\n format.html { redirect_to(@obrasproyecto) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @obrasproyecto.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /empleadobitacoras/1 DELETE /empleadobitacoras/1.xml
def destroy @empleadobitacora = Empleadobitacora.find(params[:id]) @empleadobitacora.destroy respond_to do |format| format.html { redirect_to(empleadobitacoras_url) } format.xml { head :ok } end end
[ "def destroy\n @atendimento_aee = AtendimentoAee.find(params[:id])\n @atendimento_aee.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n @empleadosautorizado.destroy\n\n respond_to do |format|\n format.html { redirect_to(empleadosautorizados_url) }\n format.xml { head :ok }\n end\n end", "def del\n @office1 = Office1.find(params[:id])\n @office1.destroy\n\n respond_to do |format|\n format.html { redirect_to(office1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exemplo = Exemplo.find(params[:id])\n @exemplo.destroy\n\n respond_to do |format|\n format.html { redirect_to(exemplos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expedicao = Expedicao.find(params[:id])\n @expedicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(expedicoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @almacenescierre = Almacenescierre.find(params[:id])\n @almacenescierre.destroy\n\n respond_to do |format|\n format.html { redirect_to(almacenescierres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @empresa = Empresa.find(params[:id])\n @empresa.destroy\n\n respond_to do |format|\n format.html { redirect_to(empresas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exalumno = @alumno.exalumno\n @exalumno.destroy\n\n respond_to do |format|\n format.html { redirect_to(alumno_path(@alumno)) }\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 @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to(emple_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @elinea = Elinea.find(params[:id])\n @elinea.destroy\n\n respond_to do |format|\n format.html { redirect_to(elineas_url) }\n format.xml { head :ok }\n end\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 @etapasproceso = Etapasproceso.find(params[:id])\n @etapasproceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(etapasprocesos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aetapa = Aetapa.find(params[:id])\n @aetapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(aetapas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @efectivo = Efectivo.find(params[:id])\n @efectivo.destroy\n\n respond_to do |format|\n format.html { redirect_to(efectivos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dependencia = Dependencia.find(params[:id])\n @dependencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(dependencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @acceso = Acceso.find(params[:id])\n @acceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(accesos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check that a domain exists
def verify_domain(domain) begin Socket.gethostbyname(domain) rescue SocketError return false end true end
[ "def domain_exist?\n !@conn.get('/').body.include? 'Domain name is unregistered!'\n end", "def domain_exists?(domain)\n domain = ::Postfix::Domain.find_by_name(domain)\n !domain.nil?\n end", "def domain_defined?(domain_name)\n domain_list.key? domain_name\n end", "def exist?(domain)\n Domain.all(:name => domain).any?\n end", "def a_domain_we_care_about?(url)\n begin\n !@domains.select { |domain| URI.parse(url).host == domain.host }.empty?\n rescue\n !@domains.select { |domain| url.gsub(/https*:\\/\\//,'').starts_with?(domain.host) }.empty?\n end\n end", "def in_domain?(uri)\n uri.host == url.host\n end", "def valid_domain?\n PublicSuffix.valid? domain\n end", "def in_domain?(uri)\n uri.host == @url.host\n end", "def is_a_domain?\n domain? && !subdomain?\n end", "def resolvable?(domain)\n Resolv.getaddress domain\n true\n rescue Resolv::ResolvError => _e\n false\n end", "def check_domain(domain)\n domain = Onlinenic::Domain.new(domain)\n @response = @wrapper.check_domain({ :domain => domain.full_name, :domaintype => domain.type })\n logout if @opts[:auto_logout]\n @response.try(:success?) ? @response.get_data(\"avail\").eql?(\"1\") ? true : false : nil\n end", "def check_domains()\n Log.info \"[ checking domains... ]\"\n \n n = number_of_domains_started()\n if n == @domain_count\n Log.info \"[ checking domains ok ]\"\n else\n Log.fatal \"[ checking domains failed ]\"\n end\n end", "def domain_check(name)\n options = { \"domains\" => [ {\"dname\" => name} ] }\n request_v2(\"domain\", \"check\", options)\n if is_success?\n record = response[\"answer\"][\"domains\"].first\n record && record[\"error_code\"].nil? && record[\"result\"] == \"Available\"\n end\n end", "def check_domain_matches(drop)\n unless custom_domain_matches? drop\n puts [ '*' * 5,\n drop.data[:url].inspect,\n env['HTTP_HOST'].inspect,\n '*' * 5\n ].join(' ')\n\n not_found\n end\n end", "def domain?\n !empty? && to_s == @domain\n end", "def in_domain?(page, uri)\n uri.host == page.url.host\n end", "def valid_domain?\n return @valid if defined? @valid\n\n unicode_host = Addressable::IDNA.to_unicode(host)\n @valid = PublicSuffix.valid?(unicode_host,\n :default_rule => nil,\n :ignore_private => true)\n end", "def domain_known?(domain)\n\t\ttracker=Wmap::DomainTracker.instance\n if @data_dir\n tracker.data_dir=@data_dir\n tracker.domains_file=tracker.data_dir + \"/\" + \"domains\"\n tracker.load_domains_from_file(tracker.domains_file)\n end\n\t\ttracker.domain_known?(domain)\n\tend", "def is_domain_available?(domain)\n results = check_domain(domain).items\n results.nil? ? false : results.first.available?\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check that every element of an array is an integer
def int_array_check(arr) arr.each do |element| Integer(element) != nil rescue return false end return true end
[ "def is_int_array(arr)\n arr.is_a?(Array) && arr.all? {|e| e.to_i == e}\nend", "def is_integer_array? array\n\t\treturn array.all? {|a| a.is_a? Integer}\n\tend", "def is_int_array_alt(arr)\n arr.is_a?(Array) && arr.all? { |e| e.is_a?(Integer) || e.is_a?(Float) && e % 1 == 0}\nend", "def not_int?(array)\n !array.all? { |c| c =~ /\\A\\d+\\z/ }\n end", "def _integer_array?(v)\n Array === v && v.all?{|x| nil == x || Integer === x}\n end", "def expect_array_of_integers(value, field, subfield)\n return false unless expect_array(value, field, subfield)\n error_count = 0\n value.each_with_index do |v, i|\n error_count += 1 unless expect_integer(v, field, \"#{subfield}[#{i}]\")\n end\n error_count == 0\n end", "def is_int_array(arr)\n if arr == nil || arr == ''\n return false\n elsif arr.empty?\n return true\n end\n\narr.each do |i|\n if i.class == Integer || i.class == Float && i%1==0\n else\n return false\n end\n end\ntrue\nend", "def test_int_check_pass\n assert_equal int_check([]), true # EDGE CASE\n assert_equal int_check(['1']), true # pass\n assert_equal int_check(['1', '1']), true # pass\n assert_equal int_check(['1', '1', '1']), true # pass\n end", "def return_only_integer(arr)\n arr.select { |element| element.is_a? Integer }\nend", "def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Fixnum }\nend", "def array_of_fixnums?(array)\n yes = 0\n array.each { |num| num.is_a?(Fixnum) ? nil : yes += 1 }\n yes == 0\nend", "def check_is_array(number)\n\tif number.class == Array\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def test_integer?(data)\r\n return data.to_i.to_s == data\r\n end", "def array_of_fixnums?(array)\niterator = 0\n while iterator < array.length \n if array[iterator].class != Fixnum\n return false\n end\n iterator += 1 \n if array[iterator].class == Fixnum\n return true\n end\n \n end\narray\nend", "def include?(array_of_integers, integer)\n array_of_integers.each do |num|\n return true if num == integer\n end\n false\nend", "def is_int(value)\n true if Integer(value) rescue false\n end", "def new_numbers (array)\n emptyArr = []\n array.each do |i|\n if i.class == Integer\n emptyArr << i\n end\n end\n return emptyArr\nend", "def write_array_of_int(ary)\n write_array_of_type(:int, :write_int, ary)\n end", "def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of DomainInfo objects from each row of the worksheet
def fetch_certs_from_worksheet(worksheet) # class method domain_infos = Array.new (2..worksheet.num_rows).each do |row| # first row is header domain = worksheet[row, DOMAIN_COL] days_to_notify = fetch_csv_array(worksheet[row, DAYS_COL]) # Don't use row if it is invalid if domain.empty? || !verify_domain(domain) || !int_array_check(days_to_notify) $stderr.puts("Error, row " + row.to_s + " of spreadsheet could not be parsed") next end if days_to_notify.empty? days_to_notify = DEFAULT_DAYS elsif days_to_notify.size == 1 && days_to_notify[0] == SUPPRESSION_SIGNAL next else days_to_notify.map!(&:to_i) end begin expiry_date = fetch_expiry_date(domain) error = '' rescue => e expiry_date = '' error = e.inspect end pagerduty_keys = fetch_csv_array(worksheet[row, PAGERDUTY_COL]) domain_infos.push(DomainInfo.new(domain, pagerduty_keys, expiry_date, days_to_notify, error)) end return domain_infos end
[ "def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end", "def list_domains_array()\n domains = []\n doc = Nokogiri::XML(list_domains())\n doc.xpath('/namesilo/reply/domains/domain').each do |domain|\n domains << domain\n end\n domains\n end", "def rows(sheet)\n sheet.simple_rows_with_meta_data\n end", "def entries(domain)\n sql = \"SELECT * FROM #{TABLE} WHERE domain=? ORDER BY created_at DESC\"\n query {|db| db.execute(sql, [domain]) }.map{ |row| Domain.new(*row) }\n end", "def rows\n\n return [] unless response[:cell_data]\n\n measures = [response[:axes][:axis][0][:tuples][:tuple]].flatten\n cells = [response[:cell_data][:cell]].flatten\n\n cell_ordinal = 0\n cell_index = 0\n rownum = 0\n\n [response[:axes][:axis][1][:tuples][:tuple]].flatten.collect{ |tuple|\n rownum += 1\n colnum = 0\n tuple_member = [tuple[:member]].flatten\n { rownum: rownum,\n labels: tuple_member.collect{|member|\n value = member[:caption]\n value = nil if value=='#null'\n {value: value, name: member[:@hierarchy]}\n },\n values: measures.collect{|m|\n\n colnum += 1\n\n measure = m[:member].kind_of?(Array) ? m[:member].collect{|m| m[:u_name]} : m[:member][:u_name]\n if (cell=cells[cell_index]) && cell[:@cell_ordinal].to_i==cell_ordinal\n cell_index += 1\n cell_ordinal += 1\n { colnum: colnum, measure: measure, value: cell[:value], fmt_value: cell[:fmt_value]}\n else\n cell_ordinal += 1\n { colnum: colnum, measure: measure, value: nil, fmt_value: nil}\n end\n\n }\n\n }\n }\n\n end", "def report_data\n @data[:employees].map do |id, employee_data|\n employee = Employee.new(employee_data)\n [employee.name, week_date_ranges.map { |range| \n employee.net_hours_for_date_range(range)} ]\n end\n end", "def results\n get_domain_data\n end", "def rows\n Array.new self\n end", "def domain\n @X.keys\n end", "def domains\n warn 'DEPRECATION WARNING: Varanus::Reports#domains is deprecated. ' \\\n 'Use Varanus::Domain#report instead'\n r = soap_call :get_domain_report, {}\n format_results r[:report_row_domains]\n end", "def parse_rows(sheet)\n\t\tJSON.generate({:keys => Keys, :rows => sheet.drop(5).map{|r| extract_row(r)}})\n\tend", "def domains\n return @domains\n end", "def rows_to_array(rows)\n collection = BlocRecord::Collection.new\n rows.each { |row| collection << new(Hash[columns.zip(row)]) }\n collection # return an array\n end", "def rows_to_array(rows)\n collection = BlocRecord::Collection.new\n rows.each {|row| collection << new(Hash[columns.zip(row)])}\n collection\n end", "def response_domains\n rds_qs.order(:rd_order).includes(:response_domain).map &:response_domain\n end", "def to_a\n @rows\n end", "def process_records!\n records = []\n @worksheet.rows.each_with_index do |record, index|\n record = @mapper.new(index + 1, record)\n records << record if record.valid_row?\n end\n records\n end", "def enum_domain_hosts()\n\n client = session\n domain = nil\n foundips = Array.new\n\n hosts = []\n resultHosts = []\n\n if client.platform =~ /^x64/\n size = 64\n addrinfoinmem = 32\n else\n size = 32\n addrinfoinmem = 24\n end\n\n # query the domain for users of this particular group and then parse the results\n results = (run_cmd(\"net view\")).split(\"\\n\")\n \n if results.include?(\"System error 5 has occurred.\\r\")\n print_error(\"Issue enumerating users for group \\\"#{domain_group}\\\"\")\n print_error(\"Try migrating into a different user process.\")\n return []\n end\n\n # Get group members from the output\n results.each do |line|\n if line.start_with?(\"\\\\\\\\\")\n host = line.split(\"\\\\\\\\\")[1].strip()\n vprint_status(\"Found host: #{host}\")\n hosts << host\n end\n end\n\n # use railgun to resolve the IPs for each host\n begin\n hosts.each do |x|\n vprint_status(\"Looking up IP for #{x}\")\n \n result = client.railgun.ws2_32.getaddrinfo(x, nil, nil, 4 )\n if result['GetLastError'] == 11001\n print_error(\"There was an error resolving the IP for #{x}\")\n next\n end\n # parse the railgun results\n addrinfo = client.railgun.memread( result['ppResult'], size )\n ai_addr_pointer = addrinfo[addrinfoinmem,4].unpack('L').first\n sockaddr = client.railgun.memread( ai_addr_pointer, size/2 )\n ip = sockaddr[4,4].unpack('N').first\n\n temp = {}\n temp[:hostname] = x\n temp[:ip] = Rex::Socket.addr_itoa(ip)\n temp[:ip] = '' unless temp[:ip]\n\n # ignore the localhost if it pops up\n if temp[:ip] != \"0.0.0.0\"\n resultHosts << temp\n end\n \n end\n\n rescue ::Exception => e\n print_error(\"Error: #{e}\")\n print_status('Windows 2000 and prior does not support getaddrinfo')\n end\n\n # build or formatted output table\n results = Rex::Ui::Text::Table.new(\n 'Header' => 'net view results',\n 'Indent' => 2,\n 'Columns' => ['IP', 'COMPUTER NAME']\n )\n\n # store off the results for each found host\n resultHosts.each do |x|\n results << [x[:ip], x[:hostname]]\n foundips << x[:ip]\n end\n\n # store the discovered hosts off as loot.\n print_status(\"discovered hosts stored in loot\")\n store_loot(\"discovered.hosts\", \"text/plain\", session, results.to_s, \"discovered_hosts.txt\", \"Computer Browser Discovered Hosts\")\n\n return foundips\n\n end", "def domains_list\n call('domains.list')[:domains]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expecting string: "A1:hit B10:miss" Processes the result, marks the field appropriately, changes the sequence of shots accordingly.
def process_shot_result(shot_result) shot_result.split(/:|\s/).each_slice(2) do |location, result| field[location] = result.to_sym has_hit(location) if field[location] == :hit end end
[ "def format_hit(str)\n hit_display_id = \"\"\n hit_def = \"\"\n\n hit = str.split(\" \", 2)\n if hit.length < 2\n hit_display_id = hit.first\n hit_def = \"None\"\n else\n hit_display_id = hit.first\n hit_def = hit.last\n end\n\n return hit_display_id, hit_def\n end", "def parse_protein_hit(str, desc, query_hits)\n data = str.split(\",\")\n ProteinHitFloatIndicies.each do |index|\n data[index] = data[index].to_f\n end\n data << desc\n data << query_hits\n \n ProteinHit.new(*data)\n end", "def parse_grimm(grimm_output)\n @grimm_output = grimm_output\n @parsed = {:rearrangements => []}\n parts = grimm_output.split('======================================================================')\n parts.first.split(/\\n/).each do |line|\n k, v = line.split(/:/, 2).map(&:strip)\n v.sub!(/\\s+\\(\\w+\\)$/, '') if k == \"Number of Chromosomes\"\n @parsed[k.downcase.gsub(' ', '_').to_sym] = v.match(/\\A[+-]?\\d+\\Z/) ? v.to_i : v\n end\n parts[2].split(/\\n/).each do |line|\n # Parse lines of the form:\n # Step 1: Chrom. 1, gene 587 [587] through chrom. 1, gene 591 [591]: Reversal\n next unless line =~ /^Step (\\d)+:/\n next if $1.to_i == 0\n m = line.match(/Chrom. (\\d+), gene (-?\\d+) \\[(-?\\d+)\\] through chrom. (\\d+), gene (-?\\d+) \\[(-?\\d+)\\]:([\\w ]+)/)\n @parsed[:rearrangements] << m.to_a.slice(1..-2).map(&:to_i).concat([m[-1].strip])\n end\n end", "def convert_to_goals(str_goals)\n id = 1\n for goal in str_goals\n goal_info = []\n\n # split the information of the received string as\n # [0]<id> [1]<status> [2]<content>\n goal_info = goal.split(/(\\[ \\])|(\\[x\\])/)\n status = $status_symbol.key(goal_info.at(1).strip)\n content = goal_info.at(2).strip\n $goals.push(Goal.new(id, status, content))\n\n if status == true\n $completed.push(id - 1)\n else\n $not_completed.push(id - 1)\n end\n id += 1\n end\nend", "def processHits(hits, buffer)\n printf(\"hits = %d\\n\", hits);\n ptr = buffer.unpack(\"I*\")\n p = 0\n for i in 0...hits \t#/* for each hit */\n names = ptr[p]\n printf(\" number of names for hit = %d\\n\", names); p+=1;\n printf(\" z1 is %g;\", ptr[p].to_f/0xffffffff); p+=1;\n printf(\" z2 is %g\\n\", ptr[p].to_f/0xffffffff); p+=1;\n printf(\" the name is \");\n for j in 0...names #\t/* for each name */\n printf(\"%d \", ptr[p]); p+=1\n end\n printf(\"\\n\");\n end\nend", "def parse_colon_separated_params(hash, ary)\n ary.each do |str|\n sc = StringScanner.new(str)\n sc.skip(/\\s*/)\n while sc.rest?\n if sc.match?(/Number of sequences better than +([e\\-\\.\\d]+) *\\: *(.+)/) then\n @expect = sc[1]\n @num_hits = sc[2].tr(',', '').to_i\n end\n if sc.skip(/([\\-\\,\\.\\'\\(\\)\\#\\w ]+)\\: *(.*)/) then\n hash[sc[1]] = sc[2]\n else\n #p sc.peek(20)\n raise ScanError\n end\n sc.skip(/\\s*/)\n end #while\n end #each\n end", "def Process(text)\n text.to_str.gsub(/:\\(?([a-z0-9\\+\\-_]+)\\)?:/) do |match|\n\t \n # checks, if user wanted an animated smiley or not\n animated = false\n if (match.include?('(') && match.include?(')'))\n animated = true\n end\n\n # proposed image path, if image is locally available\n\tif animated\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'animated', $1 + '.gif')\n else\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'general', $1 + '.png')\n end\n\n # returns image tag, if image locally exists\n if File.exist?(local_image)\n ImageTag($1, animated)\n\n # image doesn't exists locally\n else\n # stores the image and returns image tag, if smiley is valid\n if SmileyExist($1, animated)\n ImageStore($1, animated)\n ImageTag($1, animated)\n else\n if animated\n '('+$1+')'\n else\n ':'+$1+':'\n end\n end\n end\n\n end\n end", "def format_line_special_1(line)\n active_line = line\n\n if (line.include?(\"OUTPUT:\") == true)\n count_oc = 0\n oc_index = 0\n for char in 0...line.length\n\n\n if (line[char, 1] == \":\")\n count_oc = count_oc +1\n # after the third occurances of the ':' the '<' will appear\n # we need to know where the '<' starts so the correct segment can\n # be extracted and blank spaces can be replaced with '@'\n\n if (count_oc == 3)\n oc_index = char\n\n end\n end\n\n end\n first_oc = false\n\n for element in oc_index...line.length\n\n if (line[element, 1] == \"<\" and first_oc != true)\n begin_index = element\n first_oc = true\n end\n end\n end_index = active_line.rindex('>')\n\n if (begin_index < oc_index)\n puts \"there is fault with the index\"\n\n end\n\n extracted_info = active_line.slice(begin_index, end_index)\n\n extracted_onfo = extracted_info.gsub!(\"<\", \" \")\n extracted_info = extracted_info.gsub(\">\", \" \")\n # extracted_info = extracted_info.gsub(\"/\",\" \")\n\n\n active_line = active_line.slice(0, oc_index+1)\n\n else\n\n # begin_index = active_line.index('<')\n # puts begin_index\n # end_index = active_line.rindex('>')\n # puts end_index\n # extracted_info = active_line.slice(begin_index,end_index)\n # active_line = active_line.chomp( extracted_info)\n end\n # replaces empty spaces with @ and scale down over populated '@@@' to a normal state '@'\n # removes '<>' from the string so that the html doesnt display it as a tag\n\n if (begin_index != nil and end_index != nil)\n extracted_info = extracted_info.gsub(\" \", \"@\")\n extracted_info = extracted_info.gsub(\"@@@\", \"@\")\n active_line = active_line.gsub(\"<\", \"?\")\n active_line = active_line.gsub(\">\", \"?\")\n active_line = active_line+extracted_info\n\n end\n\n return active_line\n\n end", "def hit_string\n # Return hex value\n [@hit.to_s].pack(\"H*\").gsub(\"\\n\", \"\")\n end", "def parse_hitlist\n unless defined?(@parse_hitlist)\n @hits_found_again = []\n @hits_newly_found = []\n @hits_unknown_state = []\n i = 0\n a = @hits_newly_found\n flag = true\n @f0hitlist.each do |x|\n sc = StringScanner.new(x)\n if flag then\n if sc.skip_until(/^Sequences used in model and found again\\:\\s*$/)\n a = @hits_found_again\n end\n flag = nil\n next\n end\n next if sc.skip(/^CONVERGED\\!$/)\n if sc.skip(/^Sequences not found previously or not previously below threshold\\:\\s*$/) then\n a = @hits_newly_found\n next\n elsif sc.skip(/^Sequences.+\\:\\s*$/) then\n #possibly a bug or unknown format?\n a = @hits_unknown_state\n next\n elsif sc.skip(/^Significant (matches|alignments) for pattern/) then\n # PHI-BLAST\n # do nothing when 'alignments'\n if sc[1] == 'matches' then\n unless defined?(@hits_for_pattern)\n @hits_for_pattern = []\n end\n a = []\n @hits_for_pattern << a\n end\n next\n end\n b = x.split(/^/)\n b.collect! { |y| y.empty? ? nil : y }\n b.compact!\n if i + b.size > @hits.size then\n ((@hits.size - i)...(b.size)).each do |j|\n y = b[j]; y.strip!\n y.reverse!\n z = y.split(/\\s+/, 3)\n z.each { |y| y.reverse! }\n h = Hit.new([ z.pop.to_s.sub(/\\.+\\z/, '') ])\n bs = z.pop.to_s\n ev = z.pop.to_s\n #ev = '1' + ev if ev[0] == ?e\n h.instance_eval { @bit_score = bs; @evalue = ev }\n @hits << h\n end\n end\n a.concat(@hits[i, b.size])\n i += b.size\n end #each\n @hits_found_again.each do |x|\n x.instance_eval { @again = true }\n end\n @parse_hitlist = true\n end #unless\n end", "def parse_input attack_details\n attack_details_arr = attack_details.split(\":\")\n attack_details_arr.each do |attack_detail|\n tribal, direction, tribal_strength = attack_detail.split(\" - \")\n attacked?(tribal_strength.to_i, direction) ? @@attack_count += 1 : 0\n end\n rebuild_wall(attack_details_arr)\n print_outcome\n end", "def parse_peptide_hit(str, terms)\n return nil if str == nil || str == \"-1\"\n \n peptide_data, protein_maps = str.split(\";\", 2)\n protein_maps = protein_maps.split(\",\")\n terms = terms.split(\":\")\n \n # parse peptide data\n peptide_data = peptide_data.split(\",\")\n \n PeptideHitFloatIndicies.each do |index|\n peptide_data[index] = peptide_data[index].to_f\n end\n \n PeptideHitIntIndicies.each do |index|\n peptide_data[index] = peptide_data[index].to_i\n end\n\n # parse protein_map data\n protein_maps = protein_maps.zip(terms).collect do |map_data, terms|\n data = map_data.split(\":\") + terms.split(',')\n \n # removes quotes from protein id\n data[0] = data[0][1...-1]\n \n ProteinMapIntIndicies.each {|index| data[index] = data[index].to_i }\n ProteinMap.new(*data)\n end\n \n peptide_data << protein_maps\n PeptideHit.new(*peptide_data)\n end", "def parse_move(s)\n #int from, to, i;\n\n # /* make sure the string looks like a move */\n=begin\n if (s[0] < 'a' || s[0] > 'h' ||\n s[1] < '0' || s[1] > '9' ||\n s[2] < 'a' || s[2] > 'h' ||\n s[3] < '0' || s[3] > '9')\n return -1;\n=end\n return -1 if s.size < 4\n \n [['a', 'h'], ['0', '9'], \n ['a', 'h'], ['0', '9']].each_with_index{|(min, max), i|\n return -1 unless s[i].ord.between?(min.ord, max.ord)\n }\n \n from = s[0].ord - 'a'.ord;\n from += 8 * (8 - (s[1].ord - '0'.ord));\n to = s[2].ord - 'a'.ord;\n to += 8 * (8 - (s[3].ord - '0'.ord));\n\n @first_move[1].times{|i|\n if (@gen_dat[i].m.b.from == from && @gen_dat[i].m.b.to == to)\n\n # if the move is a promotion, handle the promotion piece;\n # assume that the promotion moves occur consecutively in\n # gen_dat. \n if CCOND(gen_dat[i].m.b.bits & 32)\n case s[4]\n when 'N' then return i\n when 'B' then return i + 1;\n when 'R' then return i + 2;\n else # /* assume it's a queen */\n return i + 3;\n end\n end\n \n return i\n end\n }\n \n # didn't find the move */\n return -1;\n end", "def protein_hit(hit)\n key = \"h#{hit}\"\n return nil unless str = data[key]\n @protein_hits[hit] ||= parse_protein_hit(str, data[\"#{key}_text\"], query_hits(hit))\n end", "def parse_chunk(string_chunk)\n #This is a stub, used for indexing\n end", "def fix_gags(hash_of_sequence_ids_to_sequence_strings, sequence_id_to_gags={})\n log = Bio::Log::LoggerPlus['bio-gag']\n \n # Get the gags\n if sequence_id_to_gags == {}\n log.info \"Predicting gags from the pileup\"\n gags do |gag|\n sequence_id_to_gags[gag.ref_name] ||= []\n sequence_id_to_gags[gag.ref_name].push gag\n end\n else\n log.info \"Using pre-specified GAG errors\"\n end\n log.info \"Found #{sequence_id_to_gags.values.flatten.length} gag errors to fix\"\n \n # Make sure all gag errors in the pileup map to a sequence input fasta file by keeping tally\n accounted_for_seq_ids = []\n fixed_sequences = {} #Hash of sequence ids to sequences without gag errors\n hash_of_sequence_ids_to_sequence_strings.each do |seq_id, seq|\n log.debug \"Now attempting to fix sequence #{seq_id}, sequence #{seq}\"\n toilet = sequence_id_to_gags[seq_id]\n if toilet.nil?\n # No gag errors found in this sequence (or pessimistically the sequence wasn't in the pileup -leaving that issue to the user though)\n fixed_sequences[seq_id] = seq\n else\n # Gag error found at least once somewhere in this sequence\n # Record that this was touched in the pileup\n accounted_for_seq_ids.push seq_id\n \n # Output the fixed-up sequence\n last_gag = 0\n fixed = ''\n toilet.sort{|a,b| a.position<=>b.position}.each do |gag|\n #log.debug \"Attempting to fix gag at position #{gag.position} in sequence #{seq_id}, which is #{seq.length} bases long\"\n fixed = fixed+seq[last_gag..(gag.position-1)]\n fixed = fixed+seq[(gag.position-1)..(gag.position-1)]\n last_gag = gag.position\n #log.debug \"After fixing gag at position #{gag.position}, fixed sequence is now #{fixed}\"\n end\n fixed = fixed+seq[last_gag..(seq.length-1)]\n fixed_sequences[seq_id] = fixed\n end\n end\n \n unless accounted_for_seq_ids.length == sequence_id_to_gags.length\n log.warn \"Unexpectedly found GAG errors in sequences that weren't in the sequence that are to be fixed: Found gags in #{sequence_id_to_gags.length}, but only fixed #{accounted_for_seq_ids.length}\"\n end\n return fixed_sequences\n end", "def _parse_unit_output(line)\n line_match = /^\\[([AB])\\:([A-Z]+)\\#(\\d+)\\@(\\d+)\\](.*)$/.match line\n return nil unless line_match\n {\n :team => line_match[1],\n :unit_type => line_match[2],\n :unit_id => line_match[3].to_i,\n :round => line_match[4].to_i,\n :output => line_match[5]\n }\n end", "def action_from_str(str)\n # rgx_matches[i], 0 - from-to-move, 1 - capture, 2 - promotion\n rgx_matches = [str.match(/^[0-7]{2}-[0-7]{2}$/), str.match(/^x[0-7]{2}$/), str.match(/^p[0-7]{2}[NBRQ]$/)]\n\n i = 0\n while rgx_matches[i].nil? && i < 3 \n i += 1\n end\n\n case i\n when 0\n str = rgx_matches[i][0]\n from = [str[0].to_i, str[1].to_i]\n to = [str[3].to_i, str[4].to_i]\n\n move_piece(from, to)\n when 1\n str = rgx_matches[i][0]\n pos = [str[1].to_i, str[2].to_i]\n\n capture(at(pos))\n when 2\n str = rgx_matches[i][0]\n pos = [str[1].to_i, str[2].to_i]\n to_type = str[3]\n\n promote(at(pos), to_type)\n else\n raise \"Invalid format for move string!\"\n end\n end", "def process_line line\n if line.include?(\"@\") && @add_tags_to_main\n @nd[:main_tags] << line \n elsif line.include?(\"Feature:\")\n @nd[:feature] = line.sub(\"Feature:\",\"\")\n @add_tags_to_main = false\n elsif line.include?(\"Scenario:\")\n @nd[:scenarios].push({:name => line.sub(\"Scenario:\",\"\"), :steps => []})\n @add_to_s = true\n elsif\n begin\n @nd[:scenarios].last[:steps].push(line) if @add_to_s\n @add_to_s = true \n rescue\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
::new Application with parameters. Parses options Sets loglevel
def initialize(*args) parse_options(*args) set_log_level @@application = self end
[ "def initialize(appname = nil)\n @appname = appname\n @log = Logger.new(STDERR)\n @log.progname = @appname\n @level = @log.level\n end", "def initialize(options = {})\n @application = options[:application]\n @socket = options[:socket] || new_socket\n @logfile = options[:log]\n @env = options[:env] || :development\n end", "def initialize(options = {})\n @level = LOGGER_LEVEL_MAP[options[:level]] || Logger::DEBUG\n @host = options[:host] || 'localhost'\n @port = options[:port] || '514'\n @facility = options[:facility] || Syslog::LOG_USER\n @progname = options[:progname] || 'rails'\n @buffer = Hash.new { |h,k| h[k] = [] }\n @socket = {}\n @auto_flushing = options[:auto_flushing] || 1\n @local_ip = local_ip\n @remove_ansi_colors = options[:remove_ansi_colors] || true\n @ssl = options[:ssl]\n return if defined? SYSLOG\n self.class.const_set :SYSLOG, true\n end", "def initialize(app_root, options = {})\n\t\tsuper()\n\t\t@app_root = app_root\n\t\t@canonicalized_app_root = canonicalize_path(app_root)\n\t\t@options = sanitize_spawn_options(options)\n\t\t@lower_privilege = @options[\"lower_privilege\"]\n\t\t@lowest_user = @options[\"lowest_user\"]\n\t\t@environment = @options[\"environment\"]\n\t\tself.max_idle_time = DEFAULT_APP_SPAWNER_MAX_IDLE_TIME\n\t\tassert_valid_app_root(@app_root)\n\t\tdefine_message_handler(:spawn_application, :handle_spawn_application)\n\tend", "def initialize app, options = {}\n @app = app\n @except = Array(options[:except]).map { |e| regexpify e }\n @log = options[:log]\n @only = Array(options[:only]).map { |o| regexpify o }\n @path = options[:path] || \"/\"\n\n if FalseClass === @log\n @log = lambda { |m| }\n elsif !@log\n if defined? Rails\n @log = lambda { |m| Rails.logger.info \" [Onesie] #{m}\" }\n else\n @log = lambda { |m| puts \"[Onesie] #{m}\" }\n end\n end\n end", "def initialize(app, blacklist, options = {})\n @app = app\n @blacklist = blacklist\n @logger = (options[:logger] || options['logger']) || (Rails.logger if defined? Rails)\n end", "def initialize(program_name = 'rails')\n @level = Logger::DEBUG\n\n return if defined? SYSLOG\n self.class.const_set :SYSLOG, Syslog.open(program_name)\n end", "def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end", "def instance\n logger_constructor.call(env, app_name.name, **logger_constructor_options)\n end", "def initialize(args)\n\t\t\t\t# Initialize types\n\t\t\t\t@@valid_types = {bool: [], string: [String, \"\"], int: [Integer, 0], float: [Float, 0.0], choice: [String, \"\"], list: [Array, []], action: []}\n\n\t\t\t\t# Copy arguments\n\t\t\t\t@app_name = args[:name]\n\t\t\t\t@app_version = args[:version]\n\t\t\t\t@description = args[:description]\n\t\t\t\t@usage = args[:usage]\n\n\t\t\t\t# Copy messages\n\t\t\t\tmessages = args[:messages] || {}\n\t\t\t\tif messages.is_a?(Hash) then\n\t\t\t\t\t@messages = messages\n\t\t\t\telse\n\t\t\t\t\t@console.fatal(msg: \"CowtechLib::OptionParser::initialize msgs argument must be an hash.\")\n\t\t\t\tend\n\n\t\t\t\t# Initialize variables\n\t\t\t\t@console = Console.new\n\t\t\t\t@inserted = {name: [], short: [], long: []}\n\t\t\t\t@options = {}\n\t\t\t\t@options_map = {}\n\t\t\t\t@args = []\n\t\t\t\t@cmdline = ARGV.clone\n\n\t\t\t\tself << {name: \"help\", short: \"-h\", long: \"--help\", type: :bool, help: \"Show this message.\", priority: 1000}\n\t\t\tend", "def initialize(name,options = {})\n @name = name\n @log = Logger.new(STDOUT)\n @log.level = Logger::INFO\n if options[:frame]\n\t@log.debug(\"Settings frame #{options[:frame].name} for #{self.name}\")\n\tsetframe(options[:frame])\n end\n if options[:debug] == true\n\t@debug = true\n\t@log.level = Logger::DEBUG\n end\n @log.debug(\"New Lpar instance #{self.name}\") \n end", "def parse_options\n OptionParser.accept(Logger::Severity,/[0-4]/) do |s|\n case s\n when \"0\" then Logger::DEBUG\n when \"1\" then Logger::INFO\n when \"2\" then Logger::WARN\n when \"3\" then Logger::ERROR\n when \"4\" then Logger::FATAL\n else nil\n end\n end\n @optparse = OptionParser.new\n @optparse.banner = \"Usage: #{$0} [options]\"\n @optparse.define_head \"This is a Ruby application\"\n @optparse.set_summary_indent(\" \")\n @optparse.separator \"\"\n @optparse.on( '-v', '--verbose=<SEVERITY>','--[no-]verbose', Logger::Severity, '0:DEBUG/1:INFO/2:WARN/3:ERROR/4:FATAL/NONE' ) do |severity|\n @options[:verbose] = (severity==false)? nil : severity\n end\n @optparse.on( '-l', '--logfile=<logfile>', String, 'The name of the log file (verbose!=NONE)' ) do |logfile|\n @options[:logfile] = logfile\n end\n @optparse.on_tail(\"-h\", \"--help\", \"Show this message\") do\n STDOUT.puts @optparse\n exit(0)\n end\n end", "def initialize(opts = {})\r\n @opts = {\r\n :log => Logger.new(STDOUT), \r\n :log_level => Logger::INFO,\r\n :cleanup => true\r\n }.merge(opts)\r\n \r\n @logger = @opts[:log]\r\n @logger.level = @opts[:log_level]\r\n @logger.progname = 'RLayout'\r\n @logger.formatter = ErrorFormatter.new\r\n @exporters = []\r\n end", "def initialize(args = {})\n @level = args[:level] || Logger::Severity::WARN\n @loggers = []\n\n Array(args[:loggers]).each { |logger| add_logger(logger) }\n end", "def initialize command_line_args\n @control = NewRelic::Control.instance\n super(command_line_args)\n @description ||= @leftover && @leftover.join(\" \")\n @user ||= ENV['USER']\n control.env = @environment if @environment\n\n load_yaml_from_env(control.env)\n @appname ||= NewRelic::Agent.config.app_names[0] || control.env || 'development'\n @license_key ||= NewRelic::Agent.config[:license_key]\n\n setup_logging(control.env)\n end", "def initialize(options={})\n logger.level = Logger::INFO if options[:verbose]\n logger.level = Logger::DEBUG if options[:debug]\n config.load_file(options[:config]) if options[:config]\n self.workers_directory = options[:workers] if options[:workers]\n end", "def app(*params)\r\n @@app_scope ||= []\r\n self.entry :app, *(@@app_scope + params)\r\n end", "def create_application_options\n option_separator\n option_separator 'Application specific options:'\n end", "def initialize(options = {})\n @appname = File.basename($0)\n @description = []\n @examples = []\n @options = {}\n @parser = OptionParser.new do |opts|\n opts.summary_width = 10\n opts.banner = ''\n opts.on('-h', '--help', 'Display this help text.') do\n @help = true\n end\n end\n self.description = options[:description] if options[:description]\n self.examples = options[:examples] if options[:examples]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add Examiner to report on. The report will output results for all added examiners.
def add_examiner(examiner) @total_smell_count += examiner.smells_count @examiners << examiner self end
[ "def add_examiner(examiner)\n self.total_smell_count += examiner.smells_count\n examiners << examiner\n self\n end", "def << reporter\n self.reporters << reporter\n end", "def assign_examiner\n valid_examiners = User.examiners\n .can_take_test_instance\n .where(expert_language: language)\n\n users << User.user_lower_nb_test(valid_examiners) unless valid_examiners.empty?\n end", "def add_reporter(other)\n @reporter << other\n end", "def report_learner\n # I'm using the ! here so we can track down errors faster if there is an issue making\n # the report_learner\n super || create_report_learner!\n end", "def report\n Report.new do |r|\n r.probe_sets << self\n end\n end", "def add_explorer exp\n @explorers << exp\n end", "def create\n @examiner = Examiner.new(params[:examiner])\n\n respond_to do |format|\n if @examiner.save\n format.html { redirect_to(@examiner, :notice => 'Examiner was successfully created.') }\n format.xml { render :xml => @examiner, :status => :created, :location => @examiner }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @examiner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @examiner = Examiner.new(examiner_params)\n\n respond_to do |format|\n if @examiner.save\n format.html { redirect_to @examiner, notice: 'Examiner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @examiner }\n else\n format.html { render action: 'new' }\n format.json { render json: @examiner.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_exercises(exercise)\n @exercises << exercise\n end", "def create\n @examiner = Examiner.new(params[:examiner])\n\n respond_to do |format|\n if @examiner.save\n format.html { redirect_to @examiner, notice: 'Examiner was successfully created.' }\n format.json { render json: @examiner, status: :created, location: @examiner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @examiner.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_exhibit(exhibit)\n @exhibits << exhibit\n end", "def create_exams\n Course.all.each do |course|\n next if is_attending?(course) or succeeded_in?(course)\n\n exam_options = {\n :student_id => self.id,\n :course_id => course.id,\n :number => course.number,\n :attempt => attempts_for(course) + 1,\n :registered_at => Time.now\n }\n\n exams << Exam.create(exam_options)\n end\n end", "def add_email_log\n @@logs[@logname].outputters << EmailOutputter.new('email_out', # TODO (8) Make GUI for these prefs\n :server=>'heltenkelt.se',\n :port=>25,\n :domain=>'heltenkelt.se',\n :from=>'itunesfeeder@heltenkelt.se',\n :to=>'tommy@heltenkelt.se',\n :subject=>'Report from iTunesFeeder')\n end", "def record(seeder)\n seeders << seeder\n end", "def add_exhibit(exhibit)\n @exhibits.push exhibit\n end", "def each_enrollment_exemption\n enrollment_exemptions.each do |ee|\n presenter = EnrollmentExemptionPresenter.new(ee, view_context)\n yield(presenter)\n end\n end", "def report(exception_report)\n @exceptions << exception_report\n end", "def reporter(*args, &block)\n @reporters.use(*args, &block)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds a function that return a list of fitnesses for a list of genotypes. Since Parallel runs in separate fork, this overload is needed to fetch out the training set before returning the fitness to the optimizer
def gen_fit_fn type, ntrials: ntrials_per_ind return super unless type.nil? || type == :parallel nprocs = Parallel.processor_count - 1 # it's actually faster this way puts "Running in parallel on #{nprocs} processes" -> (genotypes) do print "Fits: " fits, parall_infos = Parallel.map(0...genotypes.shape.first, in_processes: nprocs, isolation: true) do |i| # env = parall_envs[Parallel.worker_number] env = parall_envs[i] # leveraging dynamic env allocation # fit = fitness_one genotypes[i, true], env: env fits = ntrials.times.map { fitness_one genotypes[i, true], env: env } fit = fits.to_na.mean print "[m#{fit}] " [fit, compr.parall_info] end.transpose puts # newline here because I'm done `print`ing all ind fits puts "Exporting training images" parall_infos.each &compr.method(:add_from_parall_info) puts "Training optimizer" fits.to_na end end
[ "def gen_fit_fn type, ntrials: nil\n type ||= :parallel\n case type\n # SEQUENTIAL ON SINGLE ENVIRONMENT\n # => to catch problems with `Parallel` env spawning\n when :sequential_single\n -> (genotypes) { genotypes.map &method(:fitness_one) }\n # SEQUENTIAL ON MULTIPLE ENVIRONMENTS\n # => to catch problems in multiple env spawning avoiding `Parallel`\n when :sequential_multi\n -> (genotypes) do\n genotypes.zip(parall_envs).map do |genotype, env|\n fitness_one genotype, env: env\n end.to_na\n end\n # PARALLEL ON MULTIPLE ENVIRONMENTS\n # => because why not\n when :parallel\n nprocs = Parallel.processor_count - 1 # it's actually faster this way\n -> (genotypes) do\n Parallel.map(0...genotypes.shape.first, in_processes: nprocs) do |i|\n fitness_one genotypes[i,true], env: parall_envs[i]\n end.to_na\n end\n else raise ArgumentError, \"Unrecognized fit type: `#{type}`\"\n end\n end", "def run(formula = [],\n chromosome = nil,\n chromosome_size = 0,\n starting_population = nil,\n population_size = 100,\n iterations = 1000,\n crossover_rate = 0.1,\n mutation_rate = 0.1,\n elitism = 0,\n selection_method = \"roulette\",\n selection_param = 10,\n desired_result = 0\n )\n\n # If starting_population is given use it as population\n # and overwrite size of what is given in params!\n # Otherwise generate random population at the begining.\n if starting_population.nil?\n population = generate_population(chromosome, chromosome_size, population_size)\n else\n population = starting_population\n end\n\n # Set first generatation\n current_generation = population\n next_generation = Array.new(0)\n\n iterations.times do |iter|\n # Calculate rating for each chromosome.\n current_generation = current_generation.each { |c| c.fitness(formula) }\n # Sort generation by rating.\n current_generation = current_generation.sort_by { |c| -(c.rating) }\n # The best fit in generation is always at 0 index.\n\n # Take elite to the next generation.\n # Elite is always on the begining due to sorting\n # at the begining of iteration.\n elitism.times do |elite|\n next_generation << current_generation[elite]\n end\n\n best_fit = current_generation[0]\n\n # puts iter.to_s + \" || \" + best_fit.rating.to_s if iter % 100 == 0\n # If the best fit is equal to the best_fit_condition\n # stop the algorithm and return results.\n if desired_result > 0 && desired_result == best_fit.rating\n return [best_fit, iter]\n end\n\n # Run selection method ((population_size - elitism) / 2)\n # times to fill the next generation. In case of population_size\n # not divisible by 2, take the random one to the to the next\n # generation by default... lucky bastard.\n ((current_generation.length - elitism) / 2).times do\n # Select pair of chromosomes.\n pair = Array.new(0)\n pair = select_pair(current_generation,\n selection_method,\n selection_param\n )\n\n # Create new instances, conflicts when copying the sample\n # chromosomes and mutate them instead of new ones!\n # In worst case elitism doesn't work at all, because\n # elite chromosomes got edited.\n pair[0] = chromosome.new(pair[0].value)\n pair[1] = chromosome.new(pair[1].value)\n\n if rand < crossover_rate\n pair = crossover(pair, rand(0..chromosome_size), chromosome)\n end\n\n pair[0].mutate(mutation_rate)\n pair[1].mutate(mutation_rate)\n\n next_generation << pair[0] << pair[1]\n end\n\n # Add lucky bastard if there is one.\n if ((current_generation.length - elitism) % 2) == 1\n next_generation << current_generation[rand(0...current_generation.length)]\n end\n\n current_generation = next_generation\n next_generation = Array.new(0)\n\n end\n # Return the best solution.\n current_generation = current_generation.each { |c| c.fitness(formula) }\n current_generation.sort_by { |c| -(c.rating) }\n\n best_fit = current_generation[0]\n\n return [best_fit, iterations]\n end", "def evaluate\n if @force_fitness_recalculation\n @karyotypes.each { |karyotype| update!(karyotype, fitness(karyotype)) }\n else\n @karyotypes.each do |karyotype|\n update!(karyotype, cached_fitness(karyotype)) if karyotype.fitness.nil?\n end\n end\n @karyotypes.sort_by! { |karyotype| - karyotype.fitness }\n end", "def solve(func)\n # setup population\n if @start_population.nil?\n population = Array.new(@population_size) do\n # generate random genotype according to the chromosome type\n { :genotype => @genotype_space.get_random }\n end\n else\n population = @start_population.map do |x|\n { :genotype => x }\n end\n end\n\n # initialize variables\n gen = 0\n overall_best = nil\n\n population_mutex = Mutex.new\n\n # default behavior is to loop forever\n begin\n gen += 1\n @logger.info(\"GA - Starting generation #{gen}\") if @logger\n\n # create latch to control program termination\n latch = Concurrent::CountDownLatch.new(@population_size)\n\n # assess fitness for every member of the population\n population.each do |s|\n @pool.post do\n # do we need to syncronize this call through population_mutex?\n # probably not.\n ret = func.call(s[:genotype])\n\n # protect write access to population struct using mutex\n population_mutex.synchronize do\n s[:fitness] = ret\n end\n\n # update latch\n latch.count_down\n end\n end\n\n # wait for all the threads to terminate\n latch.wait\n\n # find fittest member\n population_best = population.max_by {|x| x[:fitness] }\n\n # calculate overall best\n if overall_best.nil?\n overall_best = population_best\n else\n overall_best = [ overall_best, population_best ].max_by {|x| x[:fitness] }\n end\n\n # print results\n puts \"> gen #{gen}, best: #{overall_best[:genotype]}, #{overall_best[:fitness]}\" unless @quiet\n\n # execute controller\n @controller.call(self, overall_best) if @controller\n\n # selection by binary tournament\n children = new_generation(population)\n\n # update population and generation number\n population = children\n end while @exit_condition.nil? or !@exit_condition.call(gen, overall_best)\n\n # return best sample\n overall_best\n end", "def calc_fitness\n @population.each do |p|\n p.fitness(@target)\n end\n end", "def fitness_calc(genome_size, selection_coefficient)\n\t\tfitnesses = Array.new(genome_size) {0}\n\t\trunning_fitness = 1\n\t\t(0...genome_size).each do |i|\n\t\t\tfitnesses[i] = running_fitness\n\t\t\trunning_fitness *=(1-selection_coefficient)\n\t\tend\n\t\tfitnesses\n\tend", "def best_fit(num_generation = -1)\n raise \"Generation not generated still num generations = #{self.num_generations}\" if num_generation > self.num_generations\n generation = @generations[num_generation]\n @best_fitness = 0.0\n generation.collect { |chromosome|\n if chromosome\n fit = chromosome.fitness\n if fit.finite? && @best_fitness < fit\n @best_fitness = fit\n @best_chromosome = chromosome\n end\n end\n }\n [@best_chromosome, @best_fitness]\n end", "def evaluate!(candidates, opts = {})\n\n # If there are more candidate solutions than there are remaining\n # evaluations, then shuffle the list of candidates and evaluate\n # as many as possible.\n\tevals_remaining = opts[:evaluation_limit] - opts[:num_evaluations]\n\tif evals_remaining > candidates.length\n\t\tcandidates = candidates.shuffle[0...evals_remaining]\n\tend\n\n # Extract the samples and variable set for the benchmark.\n samples = opts[:samples][opts[:benchmark]]\n variables = samples[0].length == 3 ? ['x', 'y'] : ['x']\n\n # Split the list of candidates across each of the available threads.\n # If there is an error during the evaluation of a candidate then\n # set the fitness of that candidate to infinity (the worst possible).\n candidates.peach(opts[:evaluation_threads]) do |c|\n begin\n lm = compile(c.chromosome,\n opts[:grammar],\n variables: variables,\n measure: opts[:measure])\n c.fitness = samples.reduce(0) do |sum, sample|\n sum += (lm[*sample[0...-1]] - sample[-1])**2\n end\n rescue StandardError => e\n c.fitness = Float::INFINITY\n end\n end\n\n # Return the number of evaluated candidates.\n return candidates.length\n\nend", "def fitness\n\n # Comput fitness only once (memoization)\n @fitness ||= @fitness_function.fitness(self)\n end", "def fitness_of_population()\n @fitness = []\n \n # apply fit function\n @population.each_index { |i|\n c = @population[i]\n @fitness << {\n :fit => fit(c.value),\n :idx => i\n }\n }\n \n # ascending sort by distance from x-axis\n @fitness.sort! { |f1, f2| f1[:fit] <=> f2[:fit] }\n end", "def fit(x, y)\n init_attrs\n\n param_combinations.each do |prm_set|\n prm_set.each do |prms|\n report = perform_cross_validation(x, y, prms)\n store_cv_result(prms, report)\n end\n end\n\n find_best_params\n\n @best_estimator = configurated_estimator(@best_params)\n @best_estimator.fit(x, y)\n self\n end", "def fitness\n @population.each{ |p| p.fitness }\n end", "def fitness_of genome\n fitness = super genome #lol\n update_best genome, fitness\n fitness\n end", "def best_fit\n @population.max_by {|v| v.fitness}\n\n end", "def get_best(chromosomes)\n chromosomes.min_by(&:fitness)\nend", "def fittest\n fittest, index, size = 0, 0, @population.size\n while index < size\n if fitness(@population[index]) > fitness(@population[fittest])\n fittest = index\n end\n index += 1\n end\n @population[fittest]\n end", "def fitness\n @fitness || (@fitness = compute_fitness)\n end", "def solve()\n \n target_fitness = @grid.min * 1.05\n generation = 0\n solution = nil\n population = initialize_population()\n fitnesses = population.map { |p| get_fitness(p) }\n\n # Evolve population\n while generation < MAX_GENERATIONS && !solution\n\n generation = generation + 1\n next_generation = []\n\n # Reproduce to make the next generation of solutions\n while next_generation.size < POPULATION_SIZE do\n\n # Random selection of parents\n parents = [population[rand(population.size)], population[rand(population.size)]]\n\n # Reproduction / Mutation\n operator = method(GENETIC_OPERATORS[rand(GENETIC_OPERATORS.size)])\n\n if operator.arity == 1\n next_generation << operator.call(parents[0])\n else\n next_generation << operator.call(parents[0], parents[1])\n end\n\n end\n\n # Concatenate parents and new children and make the new generation the most fit elements\n population = next_generation + population\n population = population.sort_by { |x| get_fitness(x) }.take(POPULATION_SIZE)\n fitnesses = population.map { |p| get_fitness(p) }\n\n # Check solution in current population\n min_fitness = fitnesses.min \n solution = population[fitnesses.index(min_fitness)] if min_fitness <= target_fitness\n\n end\n\n return [solution, min_fitness, generation]\n\n end", "def f(groups, tutors)\n # Higher is better. The function takes into account many criteria, each of which is normalised.\n fitness = 0\n groups.each_with_index do |group, g_index|\n tutor = tutors[g_index]\n group.each do |student_x|\n group.each do |student_y|\n fitness += @alpha_ability_difference * ability_difference_criterion(student_x, student_y)\n\n # Compute this here even though it doesn't depend on student_y so as to maintain equal weighting discounting alphas\n fitness += @alpha_different_tutor * different_tutor_criterion(student_x, tutor)\n end\n end\n end\n\n fitness\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an action for an encoded observation The neural network is activated on the code, then its output is interpreted as a corresponding action
def action_for code output = net.activate code nans = output.isnan # this is a pretty reliable bug indicator raise "\n\n\tNaN network output!!\n\n" if nans.any? # action = output[0...6].max_index # limit to 6 actions action = output.max_index end
[ "def action_for observation\n # TODO: continuous actions (checked at `init_env`)\n input = observation.tolist.to_a\n # TODO: probably a function generator here would be notably more efficient\n # TODO: the normalization range depends on the net's activation function!\n output = net.activate input\n begin # NaN outputs are pretty good bug indicators\n action = output.max_index\n rescue ArgumentError, Parallel::UndumpableException\n puts \"\\n\\nNaN NETWORK OUTPUT!\"\n output.map! { |out| out = -Float::INFINITY if out.nan? }\n action = output.index output.max\n end\n end", "def mu = @neuron.activation", "def output\n output = []\n neurons.each do |neuron|\n output << neuron.activation\n end\n end", "def action_interpreter(act)\n if act.class==Array\n case act[0]\n when :msg\n unless(act[1])\n @message_window.contents.clear\n else\n display_message(act[1],true)\n end\n when :@action_selector\n @action_selector.visible=act[1]\n #@message_window.width=(act[1] ? 201 : 320)\n @Actions_Counter=0\n when :@skill_selector\n @skill_selector.visible=act[1]\n @message_window.visible=!act[1]\n @Actions_Counter=0\n when :@Actions_Counter\n @Actions_Counter=act[1]\n when :@atk_index\n @atk_index=act[1]\n @Actions_Counter=0\n when :select_atk_caract\n pos=0\n actor=@actors[@actor_actions.size]\n actor.skills_set.each_index do |i|\n skill=actor.skills_set[i]\n if skill and skill.atk_class==act[1]\n pos=i\n break\n end\n end\n case pos\n when 0\n @Actions_To_DO=[:A]+@Actions_To_DO\n when 1\n @Actions_To_DO=[:RIGHT,:A]+@Actions_To_DO\n when 2\n @Actions_To_DO=[:DOWN,:A]+@Actions_To_DO\n else\n @Actions_To_DO=[:RIGHT,:DOWN,:A]+@Actions_To_DO\n end\n #>\n end\n end\n end", "def _lex_to_state_actions; end", "def activate x\n\t\tcase @type\n\n\t\t#perceptron types\n\t\twhen :sigmoid\n\t\t\tsigmoid(x)\n\t\twhen :threshold\n\t\t\tthreshold(x)\n\t\twhen :tanh\n\t\t\ttanh(x)\n\t\twhen :none\n\t\t\tnone(x)\n\t\twhen :rectified_liniar_unit\n\t\t\trectified_liniar_unit(x)\n\t\twhen :leaky_rectified_liniar_unit\n\t\t\tleaky_rectified_liniar_unit(x)\n\t\twhen :radial_basis\n\t\t\tradial_basis(x)\n\n\t\t#I/O\n\t\twhen :input #no params\n\t\t\tnone(x)\n\t\twhen :output #no params\t\t\t\n\t\t\tnone(x)\n\t\telse\n\t\t\traise \"unknown node type: #{@type}\"\n\t\tend\n\tend", "def action\n machine.action\n end", "def op_code\n operand\n end", "def activation_code_get()\n act_code = activation_code_value_label.text\n end", "def action(event)\n @neko.send event.target[:action]\n end", "def _lex_from_state_actions; end", "def traversal_action(instruction)\n case\n when instruction[1] == :openassign then openassign(instruction)\n when instruction[1] == :closeassign then closeassign(instruction)\n \n when instruction[1] == :openvectordefinition then openvectordefinition(instruction)\n when instruction[1] == :closevectordefinition then closevectordefinition(instruction)\n\n when instruction[1] == :openvectorref then openvectorref(instruction)\n when instruction[1] == :closevectorref then closevectorref(instruction)\n \n when instruction[1] == :opendef then opendef(instruction)\n when instruction[1] == :openfuncbody then openfuncbody(instruction)\n when instruction[1] == :closefuncbody then closefuncbody(instruction)\n when instruction[1] == :closedef then closedef(instruction)\n\n when instruction[1] == :openfunc then openfunc(instruction)\n when instruction[1] == :closefunc then closefunc(instruction)\n\n when instruction[1] == :openaction then openaction(instruction)\n when instruction[1] == :closeaction then closeaction(instruction)\n\n when instruction[1] == :identifier then identifier(instruction)\n when instruction[1] == :int then int(instruction)\n when instruction[1] == :float then float(instruction)\n when instruction[1] == :range then range(instruction)\n when instruction[1] == :ref then ref(instruction)\n end\n end", "def evaluate(example)\n outs = example.dup \n \n @hidden_neurons.each do |h|\n tmp = 0\n @input_neurons.each do |i|\n tmp = tmp + @weights[h][i] * outs[i]\n end\n outs[h] = sig(tmp)\n end\n\n @output_neurons.each do |o|\n tmp = 0\n @hidden_neurons.each do |h|\n tmp = tmp + @weights[o][h] * outs[h]\n end\n outs[o] = sig(tmp)\n end\n outs\n end", "def action_label\n \"#{output_specifier} #{actions.select {|a| a != :interesting}.join(' ')}\"\n end", "def predict(observation, method = @method)\n Combine.send(method, @labels)\n end", "def op\n sequence[ip]\n end", "def code_action_kinds; end", "def evaluate(example)\n outs = example.dup\n \n @hidden_neurons.each do |h|\n tmp = 0\n @input_neurons.each do |i|\n # puts \"tamano: \" + @weights[h].length.to_s + \"\\n\"\n # puts \"weights[#{h}][#{i}]: \" + @weights[h][i].to_s + \" outs: \" + outs[i].to_s + \"\\n\"\n tmp = tmp + @weights[h][i] * outs[i]\n end\n outs[h] = sig(tmp)\n end\n\n @output_neurons.each do |o|\n tmp = 0\n @hidden_neurons.each do |h|\n tmp = tmp + @weights[o][h] * outs[h]\n end\n outs[o] = sig(tmp)\n end\n outs\n end", "def action\n @action ||= flow.execute\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /tasks_translations/1 GET /tasks_translations/1.xml
def show @tasks_translation = TasksTranslation.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @tasks_translation } end end
[ "def list\n @client.get('/translations/requests')\n end", "def index\n @translate_tasks = TranslateTask.all\n end", "def show\n @translation = @locale.translations.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @translation }\n end\n end", "def index\n\t\t@translations = Translation.all\n\t\trespond_with @translations\n\tend", "def new\n @tasks_translation = TasksTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def translations(language = nil)\n Birdman::Requester.get(\"shows/#{id}/translations/#{language}\")\n end", "def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end", "def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end", "def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end", "def index\n @example_translations = ExampleTranslation.all\n end", "def index\n get_tasks\n get_priorities\n get_users\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def show\n @events_translation = EventsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @events_translation }\n end\n end", "def request_translations(texts, options = {}, http_options = {})\n request = TranslationRequest.new(texts, options, http_options)\n # Turn the response into an array of translations\n raw = request.perform_raw\n JSON.parse(raw)['data']['translations'].map do |res|\n raw_translation = res['translatedText']\n CGI.unescapeHTML(raw_translation)\n end\n end", "def index\r\n @service_translations = ServiceTranslation.all\r\n end", "def index\n @translations_versions = TranslationsVersion.all\n end", "def show\n @pages_translation = PagesTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pages_translation }\n end\n end", "def fetch_translations(params, page = 1)\n JSON.parse(\n Tml.session.application.api_client.get(\n 'sources/sync_translations', params.merge(page: page), {raw: true}\n )\n )\n end", "def show\n service = TranslationService.find_by(name: params[:service])\n\n if service == nil then\n redirect_to raise ActionController::RoutingError.new(\"Service #{params[:service]} not found\")\n end\n\n languages = service.translation_service_languages.find_by(\n source_language: params[:from],\n target_language: params[:to])\n\n if languages == nil then\n redirect_to raise ActionController::RoutingError.new(\"Service #{params[:service]} cannot translate from #{params[:from]} to #{params[:to]}\")\n end\n\n entry = TermRequest.new(\n term: params[:term],\n source_language: languages.source_language,\n target_language: languages.target_language,\n service: service.name)\n\n entry.save\n\n formattedUrl = service.url\n .sub('{term}', entry.term)\n .sub('{from}', languages.source_language)\n .sub('{to}', languages.target_language)\n\n url = URI.parse(formattedUrl)\n req = Net::HTTP::Get.new(url.to_s)\n res = Net::HTTP.start(url.host, url.port) {|http| http.request(req) }\n\n body = Nokogiri::HTML::Document.parse(res.body)\n data = body.css('div.js-article-lingvo')\n data.each do |node|\n puts node\n end\n\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /tasks_translations/new GET /tasks_translations/new.xml
def new @tasks_translation = TasksTranslation.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @tasks_translation } end end
[ "def new\n @newtask = Newtask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newtask }\n end\n end", "def new\n @translation = Translation.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @translation }\n end\n end", "def new\n @translation = Translation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @translation }\n end\n end", "def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_task }\n end\n end", "def new\n @task = Task.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @pages_translation = PagesTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pages_translation }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @project_task = ProjectTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_task }\n end\n end", "def new\n @title = \"New Project Task\"\n @project_task = ProjectTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_task }\n end\n end", "def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @events_translation = EventsTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events_translation }\n end\n end", "def new\n @announces_translation = AnnouncesTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announces_translation }\n end\n end", "def new\n @task_document = TaskDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_document }\n end\n end", "def new\n @translationpost = Translationpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @translationpost }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @website_locale }\n end\n end", "def new\n @newsletters_translation = NewslettersTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newsletters_translation }\n end\n end", "def new\n @upcoming_task = UpcomingTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @upcoming_task }\n end\n end", "def new\n @translation = Translation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @translation }\n end\n end", "def create\n @translate_task = TranslateTask.new(translate_task_params)\n\n respond_to do |format|\n if @translate_task.save\n format.html { redirect_to @translate_task, notice: 'Translate task was successfully created.' }\n format.json { render :show, status: :created, location: @translate_task }\n else\n format.html { render :new }\n format.json { render json: @translate_task.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /tasks_translations POST /tasks_translations.xml
def create @tasks_translation = TasksTranslation.new(params[:tasks_translation]) respond_to do |format| if @tasks_translation.save format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') } format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation } else format.html { render :action => "new" } format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity } end end end
[ "def create_translations\n end", "def create\n @translate_task = TranslateTask.new(translate_task_params)\n\n respond_to do |format|\n if @translate_task.save\n format.html { redirect_to @translate_task, notice: 'Translate task was successfully created.' }\n format.json { render :show, status: :created, location: @translate_task }\n else\n format.html { render :new }\n format.json { render json: @translate_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(request)\n @client.post('/translations/requests', request)\n end", "def create\n @translation = @locale.translations.build(params[:translation])\n\n respond_to do |format|\n if @translation.save\n flash[:notice] = 'Translation was successfully created.'\n format.html { redirect_to locale_translation_path(@locale, @translation) }\n format.xml { render :xml => @translation, :status => :created, :location => @translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end", "def create\n @traduction = Traduction.new(traduction_params)\n @data = JSON.parse(open(URI.escape(\"http://translate.google.com/translate_a/t?client=p&q=\"+@traduction.fr+\"&hl=en&sl=fr&tl=en&ie=UTF-8&oe=UTF-8&multires=0\")).read)\n @tmp = @data['sentences'][0]['trans']\n @traduction.en = @tmp\n respond_to do |format|\n if @traduction.save\n format.html { redirect_to @traduction, notice: 'Traduction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @traduction }\n else\n format.html { render action: 'home' }\n format.json { render json: @traduction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @events_translation = EventsTranslation.new(params[:events_translation])\n\n respond_to do |format|\n if @events_translation.save\n format.html { redirect_to(@events_translation, :notice => 'Events translation was successfully created.') }\n format.xml { render :xml => @events_translation, :status => :created, :location => @events_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @events_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @tasks_translation = TasksTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def index\n @translate_tasks = TranslateTask.all\n end", "def create\n @translation = Translation.new\n t = params[:translation]\n @translation.key = t[:key]\n @translation.value = t[:value]\n @translation.pluralization_index = t[:pluralization_index]\n @translation.language_id = t[:language_id]\n\n respond_to do |format|\n if @translation.save\n format.html { redirect_to editor_translations_path, notice: 'Translation was successfully created.' }\n format.json { render json: @translation, status: :created, location: @translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @translate = Translate.new(translate_params)\n\n respond_to do |format|\n if @translate.save\n format.html { redirect_to @translate, notice: 'Translate was successfully created.' }\n format.json { render :show, status: :created, location: @translate }\n else\n format.html { render :new }\n format.json { render json: @translate.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_translation(key, lang, source, new_value)\n return true unless $REAL\n\n new_value_json = {\n 'target_language' => lang,\n 'type' => 'key',\n 'key' => key,\n 'source' => source,\n 'target' => new_value\n }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n # POST https://translation.io/api/v1/segments(.json)\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'POST',\n 'https://translation.io/api/v1/segments.json',\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend", "def translation_create(project_id, params)\n path = sprintf(\"/api/v2/projects/%s/translations\", project_id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::TranslationParams)\n raise PhraseApp::ParamsHelpers::ParamsError.new(\"Expects params to be kind_of PhraseApp::RequestParams::TranslationParams\")\n end\n end\n \n data_hash = params.to_h\n err = params.validate\n if err != nil\n return nil, err\n end\n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"POST\", path, reqHelper.ctype, reqHelper.body, 201)\n if err != nil\n return nil, err\n end\n \n return PhraseApp::ResponseObjects::TranslationDetails.new(JSON.load(rc.body)), err\n end", "def create(options = {})\n res = self.post \"/translate/jobs\", :body => options\n check_for_errors(res)\n res['response']\n end", "def create\n @pages_translation = PagesTranslation.new(params[:pages_translation])\n\n respond_to do |format|\n if @pages_translation.save\n format.html { redirect_to(@pages_translation, :notice => 'Pages translation was successfully created.') }\n format.xml { render :xml => @pages_translation, :status => :created, :location => @pages_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pages_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @example_translation = ExampleTranslation.new(example_translation_params)\n\n respond_to do |format|\n if @example_translation.save\n format.html { redirect_to @example_translation, notice: 'Example translation was successfully created.' }\n format.json { render :show, status: :created, location: @example_translation }\n else\n format.html { render :new }\n format.json { render json: @example_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @service_translation = ServiceTranslation.new(service_translation_params)\r\n\r\n respond_to do |format|\r\n if @service_translation.save\r\n format.html { redirect_to @service_translation, notice: 'Serviço de traduções criado com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @service_translation }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @service_translation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @translation = Translation.new(params[:translation])\n\n respond_to do |format|\n if @translation.save\n format.html { redirect_to @translation, notice: 'Translation was successfully created.' }\n format.json { render json: @translation, status: :created, location: @translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def translations_new\n\t\tif params[:res][:section] && params[:res][:subsection] && params[:res][:key]\n\t\t\tLANGUAGES.each do |l|\n\t\t\t\t@yaml = YAML.load_file(\"#{RAILS_ROOT}/config/locales/#{l}.yml\")\n\t\t\t\tif @yaml[l][params[:res][:section]][params[:res][:subsection]]\n\t\t\t\t\ttmp = { params[:res][:key] => params[:translations][l] }\n\t\t\t\t\t@yaml[l][params[:res][:section]][params[:res][:subsection]].merge!(tmp)\n\t\t\t\telse\n\t\t\t\t\ttmp = { params[:res][:subsection] => { params[:res][:key] => params[:translations][l] } }\n\t\t\t\t\t@yaml[l][params[:res][:section]].merge!(tmp)\n\t\t\t\tend\n\t\t\t\t@new=File.new(\"#{RAILS_ROOT}/config/locales/#{l}.yml\", \"w+\")\n\t\t\t\t@new.syswrite(@yaml.to_yaml)\n\t\t\tend\n\t\tend\n\t\tredirect_to '/superadmin/translations'\n\tend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /tasks_translations/1 PUT /tasks_translations/1.xml
def update @tasks_translation = TasksTranslation.find(params[:id]) respond_to do |format| if @tasks_translation.update_attributes(params[:tasks_translation]) format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @translate_task.update(translate_task_params)\n format.html { redirect_to @translate_task, notice: 'Translate task was successfully updated.' }\n format.json { render :show, status: :ok, location: @translate_task }\n else\n format.html { render :edit }\n format.json { render json: @translate_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # raise params.to_yaml\n @task = Task.find(params[:id])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to(@task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n success = true\n tries ||= 3\n request = Net::HTTP::Put.new(\"/api/projects/#{Connection.api_key}/strings/#{self.id}.yaml\")\n WebTranslateIt::Util.add_fields(request)\n request.body = self.to_json\n \n self.translations.each do |translation|\n translation.string_id = self.id\n translation.save\n end\n \n begin\n Util.handle_response(Connection.http_connection.request(request), true, true)\n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end", "def update_topic_translations(topic_id, locale, translations)\n puts \"Updating #{locale} translations for topic ##{topic_id}\"\n\n # Tries a PATCH to update an existing translation\n res = patch \"/topics/#{topic_id}/translations/#{locale}\", translations\n return true if res != false\n\n\n # If not working, tries a POST to create it\n res = post \"/topics/#{topic_id}/translations\", translations.merge(:locale => locale)\n return !!res\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to(@task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @events_translation = EventsTranslation.find(params[:id])\n\n respond_to do |format|\n if @events_translation.update_attributes(params[:events_translation])\n format.html { redirect_to(@events_translation, :notice => 'Events translation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @events_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @translation = Translation.find(params[:id])\n\n respond_to do |format|\n if @translation.update_attributes(params[:translation])\n flash[:notice] = 'Translation was successfully updated.'\n format.html { redirect_to(@translation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_task.update(api_v1_task_params)\n format.html { redirect_to @api_v1_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_task }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @tasks_translation = TasksTranslation.find(params[:id])\n @tasks_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tasks_translations_url) }\n format.xml { head :ok }\n end\n end", "def update\n @template_task = TemplateTask.find(params[:id])\n\n respond_to do |format|\n if @template_task.update_attributes(params[:template_task])\n format.html { redirect_to(@template_task, :notice => 'Template task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @subtask = Subtask.find(params[:id])\n\n respond_to do |format|\n if @subtask.update_attributes(params[:subtask])\n flash[:notice] = 'Subtask was successfully updated.'\n format.html { redirect_to(@subtask) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subtask.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @example_translation.update(example_translation_params)\n format.html { redirect_to @example_translation, notice: 'Example translation was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_translation }\n else\n format.html { render :edit }\n format.json { render json: @example_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def change_translation(id, new_value)\n # puts(\"#{id} : #{new_value}\")\n # Add the following line to prevent ACTUAL changing of the translation:\n # return true\n new_value_json = { 'target' => new_value }.to_json\n # Note: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'PATCH',\n \"https://translation.io/api/v1/segments/#{id}.json\",\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend", "def update\n @project = Project.find(params[:project_id])\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to([@task.project, @task], :notice => 'Task was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_translations\n end", "def update\n resource.update_attributes(params[:i18n_key])\n respond_with(resource, location: i18n_keys_path)\n end", "def update\n @workflow_task = WorkflowTask.find(params[:id])\n\n respond_to do |format|\n if @workflow_task.update_attributes(params[:workflow_task])\n flash[:notice] = 'WorkflowTask was successfully updated.'\n format.html { redirect_to(@workflow_task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @workflow_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @translate.update(translate_params)\n format.html { redirect_to @translate, notice: 'Translate was successfully updated.' }\n format.json { render :show, status: :ok, location: @translate }\n else\n format.html { render :edit }\n format.json { render json: @translate.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /tasks_translations/1 DELETE /tasks_translations/1.xml
def destroy @tasks_translation = TasksTranslation.find(params[:id]) @tasks_translation.destroy respond_to do |format| format.html { redirect_to(admin_tasks_translations_url) } format.xml { head :ok } end end
[ "def delete_translations\n end", "def delete(id)\n @client.delete(\"/translations/requests/#{id}\")\n end", "def delete_translations\n TranslationKey.find_by(name: description_translation_key).try(:destroy)\n end", "def destroy\n @translation = @locale.translations.find(params[:id])\n @translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(locale_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @translate_task.destroy\n respond_to do |format|\n format.html { redirect_to translate_tasks_url, notice: 'Translate task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @events_translation = EventsTranslation.find(params[:id])\n @events_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pages_translation = PagesTranslation.find(params[:id])\n @pages_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @translation = @locale.translations.find(params[:id])\n @translation.destroy\n redirect_to(locale_translations_url)\n end", "def destroy\n @translations_version.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @newsletters_translation = NewslettersTranslation.find(params[:id])\n @newsletters_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_newsletters_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @newsletters_translation = NewslettersTranslation.find(params[:id])\n @newsletters_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(newsletters_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @template_task = TemplateTask.find(params[:id])\n @template_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @announces_translation = AnnouncesTranslation.find(params[:id])\n @announces_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_announces_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @content_translation = ContentTranslation.find(params[:id])\n @content_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to content_translations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @trans_dot = TransDot.find(params[:id])\n @trans_dot.destroy\n\n respond_to do |format|\n format.html { redirect_to(trans_dots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subtask = Subtask.find(params[:id])\n @subtask.destroy\n\n respond_to do |format|\n format.html { redirect_to(subtasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stations_translation = StationsTranslation.find(params[:id])\n @stations_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stations_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transito = Transito.find(params[:id])\n @transito.destroy\n\n respond_to do |format|\n format.html { redirect_to(transitos_url) }\n format.xml { head :ok }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /contentareas/1 GET /contentareas/1.json
def show @contentarea = Contentarea.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @contentarea } end end
[ "def show\n @content_area = ContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_area }\n end\n end", "def index\n @content_areas = ContentArea.find_all_by_department_id(current_user.department.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_areas }\n end\n end", "def index\n @areas = Area.all\n respond_to do |format|\n format.html\n\n format.json{ render json: @areas }\n end\n end", "def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @areas }\n end\n end", "def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n respond_to do |format|\n format.html {}\n format.json {}\n end\n end", "def new\n @content_area = ContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_area }\n end\n end", "def show\n @exam_content_area = ExamContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_content_area }\n end\n end", "def new\n @contentarea = Contentarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contentarea }\n end\n end", "def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @areas }\n format.json {render :json => @areas}\n end\n end", "def index\n @knowledge_areas = KnowledgeArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @knowledge_areas }\n end\n end", "def content_area area\n render :partial => 'content_areas/content_area', :locals => { :area => area }\n end", "def show\n @area = Area.find(params[:id])\n render :json => @area\n end", "def index\n @group_areas = GroupArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_areas }\n end\n end", "def show\n @colaboration_area = ColaborationArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration_area }\n end\n end", "def get_area_id\n \n path = \"/cfdi/sales/areas/\"\n \n response = self.get_request(path)\n \n areas = {}\n if response.kind_of? Net::HTTPSuccess\n #JSON.parse(response.body.to_s).each do |area|\n # areas.push(area)\n #end\n areas = JSON.parse(response.body.to_s)\n end\n return areas\n \n end", "def index\n @admin_areas = Admin::Area.all\n end", "def index\n @sub_areas = SubArea.all\n end", "def index\n @specialization_areas = SpecializationArea.all\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /contentareas/new GET /contentareas/new.json
def new @contentarea = Contentarea.new respond_to do |format| format.html # new.html.erb format.json { render json: @contentarea } end end
[ "def new\n @content_area = ContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_area }\n end\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @question_content_area = QuestionContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def new\n @tarea = Tarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tarea }\n end\n end", "def create\n @contentarea = Contentarea.new(params[:contentarea])\n\n respond_to do |format|\n if @contentarea.save\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }\n format.json { render json: @contentarea, status: :created, location: @contentarea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area_type = AreaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_type }\n end\n end", "def new\n @colaboration_area = ColaborationArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colaboration_area }\n end\n end", "def new\n @exam_content_area = ExamContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_content_area }\n end\n end", "def new\n @researcharea = Researcharea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcharea }\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to cms_area_path(@area), notice: 'Area was successfully created.' }\n format.json { render json: cms_area_path(@area), status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @target_area = TargetArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @target_area }\n end\n end", "def new\n @bugarea = Bugarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bugarea }\n end\n end", "def new\n @area_of_interest = AreaOfInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_of_interest }\n end\n end", "def new\n @area_conocimiento = AreaConocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @area_conocimiento }\n end\n end", "def new\n @requerimiento_area = RequerimientoArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento_area }\n end\n end", "def new\n @group_area = GroupArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_area }\n end\n end", "def new\n @user_area = UserArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_area }\n end\n end", "def new\n @area = Area.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /contentareas POST /contentareas.json
def create @contentarea = Contentarea.new(params[:contentarea]) respond_to do |format| if @contentarea.save format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' } format.json { render json: @contentarea, status: :created, location: @contentarea } else format.html { render action: "new" } format.json { render json: @contentarea.errors, status: :unprocessable_entity } end end end
[ "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @content_area = ContentArea.new(params[:content_area])\n @content_area.department_id = current_user.department_id\n @content_area.creator = current_user\n \n respond_to do |format|\n if @content_area.save\n format.html { redirect_to content_areas_url, notice: 'Content area was successfully created.' }\n format.json { render json: @content_area, status: :created, location: @content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exam_content_area = ExamContentArea.new(params[:exam_content_area])\n\n respond_to do |format|\n if @exam_content_area.save\n format.html { redirect_to @exam_content_area, notice: 'Exam content area was successfully created.' }\n format.json { render json: @exam_content_area, status: :created, location: @exam_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to cms_area_path(@area), notice: 'Area was successfully created.' }\n format.json { render json: cms_area_path(@area), status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contentarea = Contentarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contentarea }\n end\n end", "def new\n @content_area = ContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_area }\n end\n end", "def index\n @content_areas = ContentArea.find_all_by_department_id(current_user.department.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_areas }\n end\n end", "def create\n @admin_area = Admin::Area.new(admin_area_params)\n\n respond_to do |format|\n if @admin_area.save\n format.html { redirect_to admin_areas_path, notice: '新增地區成功' }\n format.json { render :show, status: :created, location: @admin_area }\n else\n format.html { render :new }\n format.json { render json: @admin_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @areas_formacion = AreasFormacion.new(areas_formacion_params)\n\n respond_to do |format|\n if @areas_formacion.save\n format.html { redirect_to @areas_formacion, notice: 'Areas formacion was successfully created.' }\n format.json { render :show, status: :created, location: @areas_formacion }\n else\n format.html { render :new }\n format.json { render json: @areas_formacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_url, notice: result_notice_for('success.create') }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @question_content_area = QuestionContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def content_area area\n render :partial => 'content_areas/content_area', :locals => { :area => area }\n end", "def create\n @article_area = ArticleArea.new(article_area_params)\n @article_area.user_id = current_user.id\n respond_to do |format|\n if @article_area.save\n format.html { redirect_to @article_area, notice: 'Article area was successfully created.' }\n format.json { render :show, status: :created, location: @article_area }\n else\n format.html { render :new }\n format.json { render json: @article_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colaboration_area = ColaborationArea.new(params[:colaboration_area])\n\n respond_to do |format|\n if @colaboration_area.save\n format.html { redirect_to @colaboration_area, notice: 'Colaboration area was successfully created.' }\n format.json { render json: @colaboration_area, status: :created, location: @colaboration_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colaboration_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sub_area = SubArea.new(sub_area_params)\n\n respond_to do |format|\n if @sub_area.save\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully created.' }\n format.json { render :show, status: :created, location: @sub_area }\n else\n format.html { render :new }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @target_area = TargetArea.new(params[:target_area])\n\n respond_to do |format|\n if @target_area.save\n format.html { redirect_to @target_area, notice: 'Target area was successfully created.' }\n format.json { render json: @target_area, status: :created, location: @target_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @target_area.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /contentareas/1 PUT /contentareas/1.json
def update @contentarea = Contentarea.find(params[:id]) respond_to do |format| if @contentarea.update_attributes(params[:contentarea]) format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @contentarea.errors, status: :unprocessable_entity } end end end
[ "def update\n @content_area = ContentArea.find(params[:id])\n require_unlocked\n require_owner\n respond_to do |format|\n if @content_area.update_attributes(params[:content_area])\n format.html { redirect_to @content_area, notice: 'Content area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to cms_area_path(@area), notice: 'Area was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n if @question_content_area.update_attributes(params[:question_content_area])\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exam_content_area = ExamContentArea.find(params[:id])\n\n respond_to do |format|\n if @exam_content_area.update_attributes(params[:exam_content_area])\n format.html { redirect_to @exam_content_area, notice: 'Exam content area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find_using_slug!(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(area_params)\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to areas_url, notice: result_notice_for('success.update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contentarea = Contentarea.new(params[:contentarea])\n\n respond_to do |format|\n if @contentarea.save\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }\n format.json { render json: @contentarea, status: :created, location: @contentarea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub_area.update(sub_area_params)\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_area }\n else\n format.html { render :edit }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @contentarea = Contentarea.find(params[:id])\n @contentarea.destroy\n\n respond_to do |format|\n format.html { redirect_to contentareas_url }\n format.json { head :no_content }\n end\n end", "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @content_area = ContentArea.find(params[:id])\n @content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to content_areas_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @areas_formacion.update(areas_formacion_params)\n format.html { redirect_to @areas_formacion, notice: 'Areas formacion was successfully updated.' }\n format.json { render :index, status: :ok, location: @areas_formacion }\n else\n format.html { render :edit }\n format.json { render json: @areas_formacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colaboration_area = ColaborationArea.find(params[:id])\n\n respond_to do |format|\n if @colaboration_area.update_attributes(params[:colaboration_area])\n format.html { redirect_to @colaboration_area, notice: 'Colaboration area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colaboration_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @content_area = ContentArea.new(params[:content_area])\n @content_area.department_id = current_user.department_id\n @content_area.creator = current_user\n \n respond_to do |format|\n if @content_area.save\n format.html { redirect_to content_areas_url, notice: 'Content area was successfully created.' }\n format.json { render json: @content_area, status: :created, location: @content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to cms_area_path(@area), notice: 'Area was successfully created.' }\n format.json { render json: cms_area_path(@area), status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contentarea }\n end\n end", "def update\n @target_area = TargetArea.find(params[:id])\n\n respond_to do |format|\n if @target_area.update_attributes(params[:target_area])\n format.html { redirect_to @target_area, notice: 'Target area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @target_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /contentareas/1 DELETE /contentareas/1.json
def destroy @contentarea = Contentarea.find(params[:id]) @contentarea.destroy respond_to do |format| format.html { redirect_to contentareas_url } format.json { head :no_content } end end
[ "def destroy\n @content_area = ContentArea.find(params[:id])\n @content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to content_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_content_area = ExamContentArea.find(params[:id])\n @exam_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_content_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_areas_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_area.destroy\n respond_to do |format|\n format.html { redirect_to core_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :ok }\n end\n end", "def destroy\n @colaboration_area = ColaborationArea.find(params[:id])\n @colaboration_area.destroy\n\n respond_to do |format|\n format.html { redirect_to colaboration_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subarea.destroy\n respond_to do |format|\n format.html { redirect_to subareas_url, notice: 'La subárea ha sido eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_area.destroy\n respond_to do |format|\n format.html { redirect_to sub_areas_url, notice: 'Sub area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tarea = Tarea.find(params[:id])\n @tarea.destroy\n\n respond_to do |format|\n format.html { redirect_to tareas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article_area.destroy\n respond_to do |format|\n format.html { redirect_to article_areas_url, notice: 'Article area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @target_area = TargetArea.find(params[:id])\n @target_area.destroy\n\n respond_to do |format|\n format.html { redirect_to target_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet_land_area.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_land_areas_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group_area = GroupArea.find(params[:id])\n @group_area.destroy\n\n respond_to do |format|\n format.html { redirect_to group_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expertise_area.destroy\n respond_to do |format|\n format.html { redirect_to expertise_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet_office_area.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_office_areas_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @areas_formacion.destroy\n respond_to do |format|\n format.html { redirect_to areas_formacions_url, notice: 'Areas formacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /embed_code_universities POST /embed_code_universities.json
def create @embed_code_university = EmbedCodeUniversity.new(embed_code_university_params) if params[:contact_id] contact = params.require(:contact_id) @embed_code_university.university_contacts << UniversityContact.find(contact) end respond_to do |format| if @embed_code_university.save format.html { redirect_to embed_code_universities_url, notice: 'Embed Code University was successfully created.' } format.json { render :show, status: :created, location: @embed_code_university } else format.html { render :new } format.json { render json: @embed_code_university.errors, status: :unprocessable_entity } end end end
[ "def update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def destroy\n\t\t@embed_code_university.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def create\n @university_contact = UniversityContact.new(university_contact_params)\n\n if params[:university_id]\n university = params.require(:university_id)\n @university_contact.embed_code_universities << EmbedCodeUniversity.find(university)\n end\n respond_to do |format|\n if @university_contact.save\n format.html { redirect_to university_contacts_url, notice: 'University contact was successfully created.' }\n format.json { render :show, status: :created, location: @university_contact }\n else\n format.html { render :new }\n format.json { render json: @university_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_universities\n\t\t@universities = University.all\n\t\trender :json => (@universities.map { |u| u.as_json(:only => [:id,:name, :acronym, :logo])}).to_json\n\tend", "def set_university_autocomplete\n render json: {\"course_tags\": @course_tags, \"program_tags\": @program_tags}\n end", "def create\n @universidade = Universidade.new(universidade_params)\n respond_to do |format|\n if @universidade.save\n format.html { redirect_to @universidade, notice: 'IES cadastrada com sucesso!' }\n format.json { render :show, status: :created, location: @universidade }\n else\n format.html { render :new }\n format.json { render json: @universidade.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_universities_and_campuses\n\t\t@universities = University.all\n\t\trender :json => (@universities.map { |u| u.as_json(:only => [:id,:name, :acronym], :methods => [:json_campuses,:logo])}).to_json\n\tend", "def create\n @interested_university = InterestedUniversity.new(params[:interested_university])\n\n respond_to do |format|\n if @interested_university.save\n format.html { redirect_to @interested_university, notice: 'Interested university was successfully created.' }\n format.json { render json: @interested_university, status: :created, location: @interested_university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interested_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@university = University.new(params[:university])\n\n\t\tif @university.save\n\t\t\trecord_activity(\"created univeristy: \" + @university.id.to_s)\n\t\t\tredirect_to universities_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @universities = University.all\n render json: @universities\n end", "def create\n @university = University.new(params[:university])\n \n respond_to do |format|\n if @university.save\n if params[:domain]\n params[:domain].each do |d|\n @email_domain = EmailDomain.new\n @email_domain.university_id = @university.id\n @email_domain.domain = d\n @email_domain.save\n end \n end\n \n if params[:alumni_url]\n params[:alumni_url].each do |d|\n @alt_path = AltPath.new\n @alt_path.university_id = @university.id\n @alt_path.alumni_url = d\n @alt_path.save\n end \n end\n \n flash[:notice] = 'University was successfully created.'\n format.html { redirect_to(universities_url) }\n format.xml { render :xml => @university, :status => :created, :location => @university }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @university.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @city_university = CityUniversity.new(city_university_params)\n\n respond_to do |format|\n if @city_university.save\n format.html { redirect_to @city_university, notice: 'City university was successfully created.' }\n format.json { render :show, status: :created, location: @city_university }\n else\n format.html { render :new }\n format.json { render json: @city_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @interested_universities = InterestedUniversity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interested_universities }\n end\n end", "def create\n @university_event = UniversityEvent.new(university_event_params)\n\n if @university_event.save\n render json: @university_event, status: :created, location: @university_event\n else\n render json: @university_event.errors, status: :unprocessable_entity\n end\n end", "def add_user\n university = University.find(params[:university_id])\n university.users << current_user\n\n respond_to do |format|\n if university.save\n format.html { \n flash[:success] = \"Successfully joined #{university.name}!\"\n redirect_to :universities \n }\n format.json { render json: success }\n end\n end\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def create\n @invitation_code = InvitationCode.new()\n @invitation_code.company_id = params[:invitation_code][:company_id]\n if @invitation_code.save\n render json: {\n invitation_code: @invitation_code.code\n }\n end\n end", "def set_university_autocomplete\n render json: @group_tags\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /embed_code_universities/1 PATCH/PUT /embed_code_universities/1.json
def update respond_to do |format| if @embed_code_university.update(embed_code_university_params) format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' } format.json { render :show, status: :ok, location: @embed_code_university } else format.html { render :edit } format.json { render json: @embed_code_university.errors, status: :unprocessable_entity } end end end
[ "def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { respond_with_bip(@university) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@university) }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_university.update(api_university_params)\n format.html { redirect_to @api_university, notice: 'University was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @api_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested_university = InterestedUniversity.find(params[:id])\n\n respond_to do |format|\n if @interested_university.update_attributes(params[:interested_university])\n format.html { redirect_to @interested_university, notice: 'Interested university was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @university.update(university_params)\n render json: @university, status: :ok #, location: @university\n else\n render json: @university.errors, status: :unprocessable_entity\n end\n end", "def update\n @university = University.find(params[:id])\n\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @university_event = UniversityEvent.find(params[:id])\n\n if @university_event.update(university_event_params)\n head :no_content\n else\n render json: @university_event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @program_x_university.update(program_x_university_params)\n format.html { redirect_to @program_x_university, notice: 'Program x university was successfully updated.' }\n format.json { render :show, status: :ok, location: @program_x_university }\n else\n format.html { render :edit }\n format.json { render json: @program_x_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @city_university.update(city_university_params)\n format.html { redirect_to @city_university, notice: 'City university was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_university }\n else\n format.html { render :edit }\n format.json { render json: @city_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @university_choice.update(university_choice_params)\n format.html { redirect_to @university_choice, notice: 'University choice was successfully updated.' }\n format.json { render :show, status: :ok, location: @university_choice }\n else\n format.html { render :edit }\n format.json { render json: @university_choice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @universo.update(universo_params)\n format.html { redirect_to @universo, notice: 'Universo was successfully updated.' }\n format.json { render :show, status: :ok, location: @universo }\n else\n format.html { render :edit }\n format.json { render json: @universo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @university = University.find(params[:university_id])\n @complaint_type = @university.complaint_types.find(params[:id])\n authorize! :update, @complaint_type, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @complaint_type.update_attributes(params[:complaint_type])\n format.html { redirect_to([@complaint_type.university, @complaint_type], :notice => 'El tipo de reclamo ha sido actualizado correctamente.') }\n format.json { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @course_university.update(course_university_params)\n format.html { redirect_to @course_university, notice: 'Course university was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_university }\n else\n format.html { render :edit }\n format.json { render json: @course_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @city_x_university.update(city_x_university_params)\n format.html { redirect_to @city_x_university, notice: 'City x university was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_x_university }\n else\n format.html { render :edit }\n format.json { render json: @city_x_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @university = UniversityDecorator.decorate @employer_study.university\n respond_to do |format|\n if @employer_study.update_attributes(params[:employer_study])\n format.html { redirect_to @employer_study, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n if @uni_major.update_attributes(params[:uni_major])\n format.html { redirect_to @uni_major, notice: 'Uni major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uni_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @facility_code = FacilityCode.find(params[:id])\n\n respond_to do |format|\n if @facility_code.update_attributes(params[:facility_code])\n format.html { redirect_to @facility_code, notice: 'Facility code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facility_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipline_university.update(discipline_university_params)\n format.html { redirect_to @discipline_university, notice: 'Discipline university was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipline_university }\n else\n format.html { render :edit }\n format.json { render json: @discipline_university.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n\t\t@embed_code_university.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @benefit_x_university.update(benefit_x_university_params)\n format.html { redirect_to @benefit_x_university, notice: 'Benefit x university was successfully updated.' }\n format.json { render :show, status: :ok, location: @benefit_x_university }\n else\n format.html { render :edit }\n format.json { render json: @benefit_x_university.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /embed_code_universities/1 DELETE /embed_code_universities/1.json
def destroy @embed_code_university.destroy respond_to do |format| format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n #not in use\n @university.destroy\n \n respond_to do |format|\n format.html { redirect_to universities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @university = University.find(params[:id])\n @university.destroy\n\n respond_to do |format|\n format.html { redirect_to universities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interested_university = InterestedUniversity.find(params[:id])\n @interested_university.destroy\n\n respond_to do |format|\n format.html { redirect_to interested_universities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @api_university.destroy\n respond_to do |format|\n format.html { redirect_to api_universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @universidad = Universidad.find(params[:id])\n @universidad.destroy\n\n respond_to do |format|\n format.html { redirect_to universidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @universidad = Universidad.find(params[:id])\n @universidad.destroy\n\n respond_to do |format|\n format.html { redirect_to universidads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @program_x_university.destroy\n respond_to do |format|\n format.html { redirect_to program_x_universities_url, notice: 'Program x university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @city_x_university.destroy\n respond_to do |format|\n format.html { redirect_to city_x_universities_url, notice: 'City x university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @universidade.destroy\n respond_to do |format|\n format.html { redirect_to universidades_url, notice: 'IES removida com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @city_university.destroy\n respond_to do |format|\n format.html { redirect_to city_universities_url, notice: 'City university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university = University.find(params[:id])\n @university.destroy\n\n respond_to do |format|\n format.html { redirect_to(universities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @discipline_university.destroy\n respond_to do |format|\n format.html { redirect_to discipline_universities_url, notice: 'Discipline university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @period_university.destroy\n respond_to do |format|\n format.html { redirect_to period_universities_url, notice: 'Period university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university_choice.destroy\n respond_to do |format|\n format.html { redirect_to university_choices_url, notice: 'University choice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @course_university.destroy\n respond_to do |format|\n format.html { redirect_to course_universities_url, notice: 'Course university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @benefit_x_university.destroy\n respond_to do |format|\n format.html { redirect_to benefit_x_universities_url, notice: 'Benefit x university was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @facility_code = FacilityCode.find(params[:id])\n @facility_code.destroy\n\n respond_to do |format|\n format.html { redirect_to facility_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @universo.destroy\n respond_to do |format|\n format.html { redirect_to universos_url, notice: 'Universo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @univ.destroy\n respond_to do |format|\n format.html { redirect_to searches_univ_path, notice: '목록에서 대학이 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asks the user to select a player to get a card from and a rank to ask for calls add_and_reaveal and returns true if the player gets the card and calls
def try_getting_cards_from_player(selected_rank) selected_player = select_other_player selected_player_id = game.get_player_index(selected_player) if game.players[selected_player_id].has_card_with_rank?(selected_rank) add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank), selected_player.name) return true end return false end
[ "def ask_for_card(other_player, card)\n if other_player.hand.include_rank?(card.rank)\n\t push_card_to_hand(other_player.pop_card_from_hand(card))\n\t return true\n\telse\n\t push_card_to_hand\n\t return false\n\tend\n end", "def ask_for_cards_until_go_fish_and_get_last_requested_rank\n while true\n selected_rank = player.select_rank\n if !try_getting_cards_from_player(selected_rank)\n return selected_rank\n end\n end\n end", "def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end", "def draw(player,output,card)\n playerset('')\n if player == 0\n if card != false\n draw = card\n else\n draw = @@deck.randomcard\n end\n puts \"You have drawn #{draw[:name]}\"\n @@hand.addcard(draw)\n @@deck.removecard(draw)\n elsif player == 1\n draw = @@edeck.randomcard\n puts \"You have drawn #{draw[:name]}\"\n @@ehand.addcard(draw)\n @@edeck.removecard(draw)\n end\nend", "def call(card_taken, called_player)\n print card_taken ? \"Player #{called_player} had the card. \" : \"Player #{called_player} didn't have the card. \"\n print \"Press any key to continue...\\n\"\n pause\n end", "def askForCard\n n=0\n until @player_set.length == 3\n print \"Player please choose a card number(H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n while (!(1..@dealing_decks.play.length).include?choice.to_i)||(@player_set.include?(@dealing_decks.play[choice.to_i-1]))\n if choice.downcase ==\"r\"\n return 1\n elsif choice.downcase ==\"q\"\n return 2\n elsif choice.downcase == \"d\"\n del = @player_set.pop\n puts \"Nothing to delete from selection!\", n += 1 if del == nil\n n -= 1\n @player_set.each do |card|\n print \"#{@player_set.index(card)+1}: \"\n print_a_card(card)\n end\n print \"Please enter a card number (H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n elsif choice.downcase == \"h\"\n print_rules\n print \"Please enter a card number (H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n else\n print \"ERROR not a valid card number! Please enter a card (H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n end\n end\n @player_set[n]=@dealing_decks.play[choice.to_i-1]\n #Printing out choice set\n @player_set.each do |card|\n print \"#{@player_set.index(card)+1}: \"\n print_a_card(card)\n end\n n+=1\n end\n\n end", "def hit?(card_total)\n prompt_user\n player_choice = get_user_input\n if player_choice == \"h\"\n card_total = deal_card + card_total # or 'card_total += deal_card'\n elsif player_choice == \"s\"\n card_total # do not update 'card_total'\n else\n invalid_command(card_total) # other input will call #hit? again\n end\nend", "def get_player_guess(user_num, deal, deck, scores)\n # prompt the user for the cards they think make up a set\n puts \"Alright, player number #{user_num}, enter the 3 cards you think are part of the set on 3 separate lines.\"\n card1 = deal[gets.to_i]\n card2 = deal[gets.to_i]\n card3 = deal[gets.to_i]\n # check if their set is valid. if it is, update score and the deal/deck.\n is_valid_set = check_set(card1, card2, card3)\n if is_valid_set\n puts \"Good job! That's one point for you!\\n\\n\"\n scores[user_num] += 1\n update_hand_on_set(deal, deck, card1, card2, card3)\n # if their set isn't valid, tell them and do nothing.\n else\n puts \"Oof! I'm afraid that's not a valid set! Better luck next time.\\n\"\n end\nend", "def card_can_take?(card_lbl, card_played)\r\n return @deck_info[card_lbl][:rank] > @deck_info[card_played][:rank] ? true : false\r\n end", "def hit(player)\n \n deck = get_deck\n card_id = deck.sample\n card = Card.find_by(id: card_id)\n PlayerCard.create(player_id: player.id, card_id: card_id)\n rank = get_rank(card.rank)\n if(rank == 11)\n if((player.card_total + rank) > 21)\n player.card_total += 1\n else\n player.card_total += rank\n end\n else \n player.card_total += rank\n end\n if(player.card_total > 21)\n #past player cards to check for aces to make them\n #add only a one to the total\n p_cards = PlayerCard.where(player_id: player.id).pluck(:card_id)\n aces = p_cards.select{|id| id >= 49}\n non_aces = p_cards.select{|id| id < 49}\n # only does if there are aces \n # otherwise total is final\n if(aces != [])\n non_ace_cards = Card.where(id: non_aces)\n n_count = non_ace_cards.count\n ace_count = aces.count\n i = 0\n sum = 0\n while i < n_count \n sum += get_rank(non_ace_cards[i].rank)\n i += 1\n end\n j = 0\n # calculate adding the rest of the aces\n while j < ace_count\n if(sum + 11 > 21 || (sum + (11 + ace_count - (j+1))) > 21)\n sum += 1\n else \n sum += 11\n end\n j+=1\n end\n player.card_total = sum\n end\n end\n player.save\n end", "def get_computer_guess(cards, deal, deck, scores)\n # first checks if the set is valid\n is_valid_set = check_set(cards[0], cards[1], cards[2])\n # if the user set is valid, it prints a response, including their set, then updates the score\n if is_valid_set\n puts \"\\nUh oh! That's one point for the computer!\"\n puts 'Here\\'s the set the computer found: '\n puts cards[0]\n puts cards[1]\n puts cards[2]\n puts \"\\n\"\n scores[1] += 1\n # this method removes the chosen cards from the deal, deals out new cards, and updates the deck.\n update_hand_on_set(deal, deck, cards[0], cards[1], cards[2])\n else\n # if the computer chose a guess incorrectly (shouldn't happen), it responds accordingly.\n puts \"Woah! It looks like the computer guessed wrong!.\\n\"\n end\nend", "def play_blackjack\n deck = Deck.new\n player_hand = Hand.new\n player_hand.cards += deck.draw!(2)\n puts \"Player initial cards #{player_hand.cards.map(&:value).inspect}\"\n puts \"Player initial score #{player_hand.score}\"\n\n def turn(hand, deck, dealer = false)\n player_input = nil\n until player_input == \"s\" || hand.score > 21\n if dealer && hand.score < 17\n player_input = \"h\"\n elsif dealer\n player_input = \"s\"\n else\n puts \"Hit or Stand? (h/s)\"\n player_input = gets.chomp\n end\n if player_input == \"h\"\n hand.cards += deck.draw!(1)\n puts \"Player initial cards #{hand.cards.map(&:value).inspect}\"\n else\n puts \"Player Stands\"\n end\n end\n puts \"Player cards at end of turn: #{hand.cards.map(&:value).inspect}\"\n end\n\n turn(player_hand, deck)\n\n if player_hand.score <= 21\n dealer_hand = Hand.new\n dealer_hand.cards += deck.draw!(2)\n puts \"Dealer initial cards #{dealer_hand.cards.map(&:value).inspect}\"\n puts \"Dealer initial score #{dealer_hand.score}\"\n turn(dealer_hand, deck, true)\n end\n\n if player_hand.score > 21\n puts \"Player busts\"\n elsif dealer_hand.score > 21\n puts \"Dealer busts\"\n elsif player_hand.score > dealer_hand.score\n puts \"Player wins\"\n elsif dealer_hand.score > player_hand.score\n puts \"Dealer wins\"\n else\n puts \"Tie\"\n end\nend", "def play_set(cards_available, cards_displayed, cards_used, players)\r\n\tputs \"Starting a new game!\"\r\n\r\n\t#reshuffle the deck\r\n\tshuffle_deck(cards_available, cards_displayed, cards_used)\r\n\r\n\t# Put twleve cards into the displayed by default\r\n\tadd_random_available_cards_to_displayed(cards_available, cards_displayed, 12)\r\n\r\n\t#display cards as long as there are at least 3\r\n\twhile cards_displayed.length >= 3 do\r\n\t\tinput_string = \"Which are sets? Enter player name and card indexes separated by a space. Enter blank if set not found. (#{cards_available.length} cards left in available deck) #{cards_displayed.enum_for(:each_with_index).map{|card, i| \"\\n#{i + 1}: #{card.to_string()}\"}.join(\"\")}\"\r\n\r\n\t\tinput = prompt(input_string)\r\n\r\n\t\t#if user enters an empty space, it means they cannot find a set\r\n\t\tif input == \"quit\"\r\n\t\t\tquit = prompt(\"Are you sure you want to quit? \")\r\n\t\t\t#allow players to end game\r\n\t\t\tif quit == \"yes\" || quit == \"y\"\r\n\t\t\t\treturn\r\n \tend\r\n\t\telsif input != \"\"\r\n\t\t\t#take user input and divide into names and card indices \r\n\t\t\ttokens = input.split(\" \")\t\t\t\r\n\t\t\tplayer_name = tokens[0]\r\n\r\n\t\t\ttokens.delete_at(0)\r\n\t\t\t#if not a valid int input change n to 0 so not in range of 1-12\r\n\t\t\tnumbers = tokens.map {|n| Integer(n) rescue 0} \r\n\t\t\t#check if user inserted valid input. i.e. valid card number or existing player name\r\n\t\t\twhile tokens.length != 3 || numbers.any? {|num| !(num.between?(1,12))} || !(players.any? {|p| p.name == player_name }) do\r\n\t\t\t\tif !(players.any? {|p| p.name == player_name })\r\n\t\t\t\t\tputs(\"Player not found, please try again\\n\")\r\n\t\t\t\telse\r\n\t\t\t\t\tputs(\"Invalid card number, please try again\\n\")\r\n\t\t\t\tend\r\n\r\n\t\t\t\tinput = prompt(input_string)\r\n\t\t\t\ttokens = input.split(\" \")\r\n\t\t\t\tplayer_name = tokens[0]\r\n\t\t\t\ttokens.delete_at(0)\r\n\t\t\t\tnumbers = tokens.map {|n| Integer(n) rescue 0}\r\n\t\t\tend\r\n\r\n\t\t\t#array for cards chosen by player\r\n\t\t\tcards = []\r\n\r\n\t\t\t#add chosen cards from cardsDisplayed to cards array\r\n\t\t\tfor i in 1..cards_displayed.length\r\n\t\t\t\tif numbers.include?(i)\r\n\t\t\t\t\tcards.push(cards_displayed[i - 1])\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\t#check if the cards chosen by player are a set. Keep track of which player chose the cards\r\n\t\t\tif is_set(cards[0], cards[1], cards[2])\r\n\t\t\t\tplayer = players.find {|p| p.name == player_name}\r\n\r\n\t\t\t\t#update the player's score tally if they have chosen a set correctly\r\n\t\t\t\tplayer.score += 1\r\n\t\t\t\tputs \"\\nThis is a set! #{player.name} has scored #{player.score} times!\"\r\n\r\n\t\t\t\t#refill the array to make sure 12 cards are displayed to players again\r\n\t\t\t\tif cards_displayed.length > 12\r\n\t\t\t\t\tadd_three_displayed_cards_to_used(cards_displayed, cards_used, cards[0], cards[1], cards[2])\r\n\t\t\t\telse\r\n\t\t\t\t\tadd_three_displayed_cards_to_used(cards_displayed, cards_used, cards[0], cards[1], cards[2])\r\n\t\t\t\t\tadd_random_available_cards_to_displayed(cards_available, cards_displayed, 3)\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tputs \"\\nNot a set, try again\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\t#if user cannot find a set, add 3 more cards\r\n\t\t\tif cards_available.length >= 3\r\n\t\t\t\tputs \"\\nOkay...here's some more\"\r\n\t\t\t\tadd_random_available_cards_to_displayed(cards_available, cards_displayed, 3)\r\n\t\t\telse\r\n\t\t\t\t#gives user more cards if there are less than 3 left\r\n\t\t\t\tputs \"\\nNo more left, use these cards!\"\r\n end\r\n\t\tend\r\n\tend\r\n\r\n\t#calculate the winner of the game by tracking points\r\n\twinner = players.reduce {|most_points, current_points| current_points.score > most_points.score ? current_points : most_points }\r\n\r\n\t#keep track of number of times each player has won\r\n\twinner.win_count += 1\r\n\tputs \"Game over... #{winner.name} won with #{winner.score} points! #{winner.name} has won #{winner.win_count} times.\"\r\n\r\n\t#reset each player's score to 0 after game has ended and scores tallied \r\n\tplayers.each {|player| player.score = 0}\r\nend", "def player_action user_id, user_input=nil\n return false unless player_up?(user_id)\n current_player_index = player_index(user_id)\n \n # check if we are in bidding or playing a card\n if (!done_bidding?) && user_input.to_s !~ /^\\d+$/ # aka: user input == Card\n return false # correct user - played card rather than bid\n elsif !done_bidding?\n bid = user_input.to_i\n if !bid_in_range?(bid) \n return false\n elsif invalid_dealer_bid?(user_id, bid)\n return false\n end\n \n # record the bid\n config[:bids][current_player_index] = bid\n\n if config[:dealer_index] == current_player_index # dealer is last to bid, bidding is done\n set_first_to_play_hand\n else\n to_left = next_player_index config[:waiting_on_index]\n add_waiting_info(to_left, \"Bid\")\n end\n\n elsif !config[:player_hands][current_player_index].empty?\n # player is playing a card\n card = user_input\n \n # ensure that the card is in their inventory\n return false unless card_in_player_hand?(current_player_index, card)\n\n # ensure that the card is actually playable\n if config[:first_suit_played].nil?\n config[:first_suit_played] = card.suit\n if config[:first_suit_played] == config[:trump_card].suit && !ignore_trump? \n config[:last_to_lead_with_trump] = current_player_index\n end\n end\n playable_cards = get_playable_cards(config[:player_hands][current_player_index])\n # TODO: add a message here?\n return false unless playable_cards.include? card\n \n # actually play the card\n config[:cards_in_play][current_player_index] = config[:player_hands][current_player_index].delete(card)\n\n set_winner_card_index(current_player_index) # is this correct...\n # check to see if all players have played a card\n if all_players_played_a_card?\n add_waiting_info(config[:winner_index], 'Clear')\n else\n # set next player to play a card\n next_up = next_player_index(current_player_index)\n add_waiting_info(next_up, \"Play\")\n end\n end\n \n save_state config \n end", "def hit?(card_total)\n prompt_user\n user_input = get_user_input\n if user_input == \"h\"\n card_total += deal_card\n elsif user_input == \"s\"\n card_total\n else\n invalid_command\n prompt_user\n get_user_input\n end\nend", "def carrying_card?\n click and card\n end", "def hit?(card_total)\n prompt_user\n selection = get_user_input\n case selection\n when \"h\"\n card_total += deal_card\n when \"s\"\n card_total\n end\n return card_total\nend", "def valid_card_play?(card)\n case \n when !self.empty?\n return (card.rank == top_rank-1) && (card.color != top_color)\n when self.empty? && foundation?\n return true\n when self.empty? && corner? \n return (card.rank == 13) #king\n end\n false\n end", "def canAnswer( playerIndex, guess )\n \n cardsFound = Array.new(0) # to store the cards that are in the guess and are reveived by the this player.\n indexOfCardToShow = -1 # index of the card that to be shown to the player who made a guess in the array above.\n cardToShow = nil # the paticular card that is about to be shown.\n \n puts \"Asking player #{@indexOfCurrentPlayer}. \"\n \n # iterate all cards this player owns to find those in the guess.\n for i in 0...@cardsInHand.length\n if( @cardsInHand[i].type() == :person )\n if(guess.person().value() == @cardsInHand[i].value())\n cardsFound.push(@cardsInHand[i])\n end\n elsif( @cardsInHand[i].type() == :place )\n if(guess.place().value() == @cardsInHand[i].value())\n cardsFound.push(@cardsInHand[i])\n end\n elsif( @cardsInHand[i].type() == :weapon )\n if(guess.weapon().value() == @cardsInHand[i].value())\n cardsFound.push(@cardsInHand[i])\n end\n end #if\n end #for\n \n # if there IS any cards found, which means that the player can answer the guess.\n if(cardsFound.length != 0 ) \n # if there is only one card, just show it.\n if(cardsFound.length == 1)\n puts \"Player #{playerIndex} asked you about guess: #{guess.person.value} in #{guess.place.value} with the #{guess.weapon.value}, you only have one card, #{cardsFound[0].value}, showed it to them.\"\n cardToShow = cardsFound[0]\n # otherwise, ask the human player to choose a card to show.\n else \n puts \"Player #{playerIndex} asked you about guess: #{guess.person.value} in #{guess.place.value} with the #{guess.weapon.value}, Which do you show? \"\n \n for i in 0... cardsFound.length\n puts \"#{i}: #{cardsFound[i].value}\" \n end\n \n indexOfCardToShow = gets.chomp.to_i\n \n while( indexOfCardToShow < 0 || indexOfCardToShow > cardsFound.length - 1 )\n puts \"Invalid number. Please enter again. \"\n indexOfCardToShow = gets.chomp.to_i\n end\n \n cardToShow = cardsFound[indexOfCardToShow]\n end\n # if there is no card found, then this player can not answer this guess.\n else\n puts \"Player #{playerIndex} asked you about guess: #{guess.person.value} in #{guess.place.value} with the #{guess.weapon.value}, but you couldn't answer. \"\n end\n \n return cardToShow \n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lets the user ask for cards unitl they don't get a card with the rank they ask for. Returns the last requested rank.
def ask_for_cards_until_go_fish_and_get_last_requested_rank while true selected_rank = player.select_rank if !try_getting_cards_from_player(selected_rank) return selected_rank end end end
[ "def rank\n puts 'RANK'\n puts self\n puts current_value\n value_idx = Card.possible_ranks.index(current_value)\n ranks[value_idx]\n end", "def ask_for_card(other_player, card)\n if other_player.hand.include_rank?(card.rank)\n\t push_card_to_hand(other_player.pop_card_from_hand(card))\n\t return true\n\telse\n\t push_card_to_hand\n\t return false\n\tend\n end", "def find_card(rank, suit, deck)\n (0..51).each do |i|\n c = deck[i]\n if (c & suit) && (rank(c) == rank)\n i\n else\n -1\n end\n end\n end", "def try_getting_cards_from_player(selected_rank)\n selected_player = select_other_player\n selected_player_id = game.get_player_index(selected_player)\n if game.players[selected_player_id].has_card_with_rank?(selected_rank)\n add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank), selected_player.name)\n return true\n end\n return false\n end", "def rank\n fetch('games.clash_of_clans.ranks')\n end", "def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end", "def rank_of_suit\n SUITS.each_with_index do |suit, i|\n if suit == @suit\n return i\n end\n end\n raise 'suit not found'\n end", "def rank\n\t\thand_stats = []\n\t\thand_stats = {:ACE=>0, :TWO=>0, :THREE=>0, :FOUR=>0, :FIVE=>0, :SIX=>0, :SEVEN=>0, :EIGHT=>0, :NINE=>0, :TEN=>0, :JACK=>0, :QUEEN=>0, :KING=>0}\n\t\t@hand.each do |card, status|\n\t\t\tif status == true \n\t\t\t\thand_stats[card.kind] += 1\n\t\t\tend\n\t\tend\n\t\t\n\t\t#find max \"kind\" count (there is a max method for this but can't figure it out so just writing it myself)\n\t\trank = 0\n\t\thand_stats.each do |card, count|\n\t\t\tif count > rank \n\t\t\t\trank = count\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\t\treturn rank - 1\n\t\t\n\tend", "def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end", "def rank\n\t\tRANKINGS.each do |ranking|\n\t\t\treturn ranking if self.send(\"#{ranking}?\".to_sym)\n\t\tend\n\tend", "def getUsersCardInput\n\t\t@userChoice.clear\n\t\twhile @userChoice.length < 3 do\n\t\t\tputs \"Enter a card number between 1 and \" + @table.length.to_s + \" or enter 0 for a hint (0 will also clear your prior choices) :\"\n\t\t\tchoice = gets.chomp!\n\t\t\tif (1..@table.length) === choice.to_i and !@userChoice.include?(choice.to_i)\n\t\t\t\t@userChoice.push(choice.to_i)\n\t\t\telse\n\t\t\t\tif choice == \"0\"\n\t\t\t\t\tfindSet.printCard\n\t\t\t\telse\n\t\t\t\t\tputs \"Invalid input! Please try again.\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn @userChoice\n\tend", "def rank_starting_hand\r\n sorted_hand = @hole_cards.sort_by { |card| card.rank } # [4,2] => [2,4]\r\n\r\n # Shorthand variables for two cards in hand\r\n (first,second) = [sorted_hand[0],sorted_hand[1]]\r\n\r\n suited = first.suit == second.suit # True if cards have same suit\r\n paired = first.rank == second.rank # True if cards have same rank\r\n connected = first.rank + 1 == second.rank # True if cards have consecutive ranks\r\n\r\n # Check for playable hands and return their rank\r\n # (Some of these checks aren't necessary but are included for readibility)\r\n case first.rank\r\n when 8 then return 14 if paired # Pocket Eights\r\n when 9 then return 9 if paired # Pocket Nines\r\n when 10\r\n return 6 if paired # Pocket Tens\r\n return 20 if second.rank == 12 and suited # Queen-Ten Suited\r\n return 16 if second.rank == 13 and suited # King-Ten Suited\r\n return 12 if second.rank == 14 and suited # Ace-Ten Suited\r\n when 11\r\n return 4 if paired # Pocket Jacks\r\n return 17 if second.rank == 12 and suited # Queen-Jack Suited\r\n return 15 if second.rank == 13 and suited # King-Jack Suited\r\n if second.rank == 14\r\n return suited ? 10 : 18 # Ace-Jack Suited/Offsuit\r\n end\r\n when 12\r\n return 3 if paired # Pocket Queens\r\n if second.rank == 13\r\n return suited ? 11 : 19 # King-Queen Suited/Offsuit\r\n elsif second.rank == 14\r\n return suited ? 8 : 13 # Ace-Queen Suited/Offsuit\r\n end\r\n when 13\r\n return 2 if paired # Pocket Kings\r\n if second.rank == 14\r\n return suited ? 5 : 7 # Ace-King Suited/Offsuit\r\n end\r\n when 14 then return 1 if paired # Pocket Aces\r\n end\r\n # Still played if the hand is suited, paired, or connected, otherwise not played\r\n return (suited or paired or connected) ? 21 : -1\r\n end", "def winning_card(trick)\n if trick.cards.compact.size == 4 # Trick is complete.\n if self.trumps # Suit contract.\n trumpcards = trick.cards.compact.select { |c| c.suit_i == self.trumps }\n if trumpcards.size > 0 # Highest ranked trump.\n return trumpcards.max \n else # we re in trump contract but play didn't have a trump.\n followers = trick.cards.compact.select { |c| c.suit == trick.leader_card.suit }\n return followers.max # Highest ranked card in lead suit.\n end\n else\n # No Trump contract, or no trump cards played.\n followers = trick.cards.compact.select { |c| c.suit == trick.leader_card.suit }\n return followers.max # Highest ranked card in lead suit.\n end\n else\n return false\n end\n end", "def count_cards_with_rank rank\n count = 0;\n @cards.each do |card|\n count +=1 if card.rank.eql?(rank)\n end\n count\n end", "def askForCard\n n=0\n until @player_set.length == 3\n print \"Player please choose a card number(H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n while (!(1..@dealing_decks.play.length).include?choice.to_i)||(@player_set.include?(@dealing_decks.play[choice.to_i-1]))\n if choice.downcase ==\"r\"\n return 1\n elsif choice.downcase ==\"q\"\n return 2\n elsif choice.downcase == \"d\"\n del = @player_set.pop\n puts \"Nothing to delete from selection!\", n += 1 if del == nil\n n -= 1\n @player_set.each do |card|\n print \"#{@player_set.index(card)+1}: \"\n print_a_card(card)\n end\n print \"Please enter a card number (H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n elsif choice.downcase == \"h\"\n print_rules\n print \"Please enter a card number (H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n else\n print \"ERROR not a valid card number! Please enter a card (H/h for help and R/r for Restart and Q/q for Quit and D/d to delete last card from your selection): \"\n choice=gets.chomp\n end\n end\n @player_set[n]=@dealing_decks.play[choice.to_i-1]\n #Printing out choice set\n @player_set.each do |card|\n print \"#{@player_set.index(card)+1}: \"\n print_a_card(card)\n end\n n+=1\n end\n\n end", "def card_value\n the_value = 0\n case @rank\n when :ace \n the_value = 1\n when :two \n the_value = 2\n when :three\n the_value = 3\n when :four\n the_value = 4\n when :five\n the_value = 5\n when :six\n the_value = 6\n when :seven\n the_value = 7\n when :eight\n the_value = 8\n when :nine\n the_value = 9\n else\n the_value = 10\n end\n return the_value\n end", "def cards_with_same_rank(rank)\n @cards.select { |card| card.rank == rank }\n end", "def card_ranks\n load_cards_data['ranks']\n end", "def rank_of_card_at(index)\n cards[index].rank\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a card to the player's hand. Announces it to other players, but doesn't show what card got added
def add_card_without_revealing_details(card) player.add_card_to_hand(card) message = "#{player.name} drew a card from the center." game.players.each {|player| player.send_message_to_user(message)} end
[ "def add_card(card)\n add_card_to_hand(card)\n end", "def add_card_to_hand(card)\n @hand.add_card(card)\n end", "def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to this hand anymore.\"\n \tend\n end", "def give_card(card)\n @hand.push(card)\n end", "def add_card(card)\n @cards.append(card)\n end", "def add_card(card)\n @deck.add(card, :back)\n end", "def addCardsToHand(cards)\n @hand.concat(cards)\n end", "def add_to_hand(card)\n self.hand.add_card_to_top(card) unless hand.nil?\n end", "def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end", "def receive(card)\n @hand.add_to_hand(card)\n end", "def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end", "def add_card(c)\n @cards_showing.push(c)\n @table_size += 1\n end", "def push_a_card(one_card)\n @deck << one_card\n end", "def setCard (card)\n # player has been dealt a particular card\n @cards << card\n\n end", "def add_cards(hand)\n hand.concat( @cards.shift(3))\n end", "def add(card)\n return unless card.is_a? Card\n # only allow cards to be added\n @cards << card\n end", "def add_member_to_card\n @trello.add_commander_to_card(find_member, @card)\n end", "def <<(card)\n @cards << card\n end", "def draw_card\n unless self.deck.empty?\n self.hand.push(self.deck.pop)\n self.save\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /alco_drinks GET /alco_drinks.json
def index @alco_drinks = AlcoDrink.all end
[ "def get_cocktail_info_from_cocktail_db(cocktail_db_drink_id)\n response = RestClient.get 'https://www.thecocktaildb.com/api/json/v1/1/lookup.php?i=' + cocktail_db_drink_id\n drink_info = JSON.parse(response)[\"drinks\"][0]\nend", "def get_drink_catagory_from_api(drink_hash)\n return drink_hash[\"drinks\"][0][\"strIBA\"]\nend", "def show\n @fooddrink = Fooddrink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fooddrink }\n end\n end", "def index\n\t\t@drinks = Drink.all\n\tend", "def get_category_urls\n raw_data = RestClient.get('http://www.thecocktaildb.com/api/json/v1/1/list.php?c=list')\n category_data = JSON.parse(raw_data)\n base_url = 'http://www.thecocktaildb.com/api/json/v1/1/filter.php?c='\n category_urls = []\n category_data['drinks'].each do |category|\n category_urls << (base_url + category['strCategory'])\n end\n category_urls\nend", "def get_drink_ids\n category_urls = get_category_urls\n drink_ids = []\n category_urls.each do |url|\n raw_data = RestClient.get(url)\n drinks_category = JSON.parse(raw_data)\n drinks_category['drinks'].each do |drink|\n drink_ids << drink['idDrink']\n end\n end\n drink_ids\nend", "def get_brandings\n request :get,\n '/v3/brandings.json'\n end", "def drink\n @drinks = Item.select {|k,v| k.product_type_id == 4 }\n \n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @drinks, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "def show\n @drink_item = DrinkItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drink_item }\n end\n end", "def show\n @drinker = Drinker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @drinker }\n end\n end", "def search\n \n # get search term\n if params[:search].nil?\n @drinks = []\n else \n @drinks = Drink.search(params[:search]).limit(50).order('lower(name) ASC')\n if @drinks.nil?\n @drinks = []\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :drinks=>@drinks.as_json(:only => [:id, :name, :popular], :methods => [:photo_url])\n } }\n end\n end", "def create\n @alco_drink = AlcoDrink.new(alco_drink_params)\n\n respond_to do |format|\n if @alco_drink.save\n format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' }\n format.json { render :show, status: :created, location: @alco_drink }\n else\n format.html { render :new }\n format.json { render json: @alco_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @deals = @business.deals \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deals }\n end\n end", "def index\n @api_dishes = Dish.all\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @includes_drink = IncludesDrink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @includes_drink }\n end\n end", "def get_bart_bsa_get_advisories\n \n puts \"get_bart_bsa_get_advisories\"\n \n client_options = {\n orig: client_params[:orig]\n }\n \n puts \"client_options: \" << client_options.inspect\n \n bart_bsa_get_advisories(client_options)\n end", "def get_drink_name_from_api(drink_hash)\n return drink_hash[\"drinks\"][0][\"strDrink\"]\nend", "def get_drink_ID_from_api(drink_hash)\n return drink_hash[\"drinks\"][0][\"idDrink\"]\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /alco_drinks POST /alco_drinks.json
def create @alco_drink = AlcoDrink.new(alco_drink_params) respond_to do |format| if @alco_drink.save format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' } format.json { render :show, status: :created, location: @alco_drink } else format.html { render :new } format.json { render json: @alco_drink.errors, status: :unprocessable_entity } end end end
[ "def create_drinks\n drink_ids = get_drink_ids\n drink_ids.each do |id|\n raw_data = RestClient.get(\"http://www.thecocktaildb.com/api/json/v1/1/lookup.php?i=#{id}\")\n drink_data = JSON.parse(raw_data)['drinks'][0]\n new_drink = Drink.find_or_create_by(drink_name: drink_data['strDrink'])\n new_drink.drink_name = drink_data['strDrink']\n new_drink.api_id = drink_data['idDrink']\n new_drink.instructions = drink_data['strInstructions']\n new_drink.alcoholic = drink_data['strAlcoholic']\n new_drink.category = drink_data['strCategory']\n new_drink.sign = get_sign(drink_data)\n new_drink.no_ingredients = create_ingredients(drink_data)\n # binding.pry\n new_drink.save\n create_recipes(drink_data, new_drink)\n end\nend", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @drink = Drink.new(drink_params)\n\n respond_to do |format|\n if @drink.save\n format.html { redirect_to @drink, notice: 'Drink was successfully created.' }\n format.json { render :show, status: :created, location: @drink }\n else\n format.html { render :new }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fooddrink = Fooddrink.new(params[:fooddrink])\n\n respond_to do |format|\n if @fooddrink.save\n format.html { redirect_to @fooddrink, notice: 'Fooddrink was successfully created.' }\n format.json { render json: @fooddrink, status: :created, location: @fooddrink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @alco_drinks = AlcoDrink.all\n end", "def create\n @drinker = Drinker.new(params[:drinker])\n\n respond_to do |format|\n if @drinker.save\n format.html { redirect_to @drinker, :notice => 'Drinker was successfully created.' }\n format.json { render :json => @drinker, :status => :created, :location => @drinker }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @drinker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ayu_din = AyurvedaDincharya.new(bike_params)\n\n if @ayu_din.save\n render json: @ayu_din, status: :created #serializer: Web::V1::BikeSerializer\n else\n render json: @ayu_din.errors, status: :unprocessable_entity\n end\n end", "def create\n @includes_drink = IncludesDrink.new(params[:includes_drink])\n\n respond_to do |format|\n if @includes_drink.save\n format.html { redirect_to @includes_drink, notice: 'Includes drink was successfully created.' }\n format.json { render json: @includes_drink, status: :created, location: @includes_drink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @includes_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_drink(drink_hash)\n drink = Drink.create(name: drink_hash[\"strDrink\"].strip.titleize.downcase, instructions: drink_hash[\"strInstructions\"],\n vessel: drink_hash[\"strGlass\"].strip.downcase, category: drink_hash[\"strCategory\"].strip.downcase)\n drink_hash[\"strAlcoholic\"] == \"Alcoholic\" ? drink.alcoholic = 1 : drink.alcoholic = 0\n drink.save\n create_ingredient_arrays(drink, drink_hash)\nend", "def create\n @drink_item = DrinkItem.new(drink_item_params)\n\n respond_to do |format|\n if @drink_item.save\n format.html { redirect_to @drink_item, notice: 'Drink item was successfully created.' }\n format.json { render :show, status: :created, location: @drink_item }\n else\n format.html { render :new }\n format.json { render json: @drink_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:bubble_tea][:store_id] = params[:id] unless params[:bubble_tea][:store_id].present?\n @bubble_tea = BubbleTea.new(bubble_tea_params)\n\n if @bubble_tea.save\n # successful bubble tea drink creation\n render json: @bubble_tea\n else\n render plain: \"Failed to save drink.\"\n end\n end", "def create\n @drink_shop = DrinkShop.new(drink_shop_params)\n\n respond_to do |format|\n if @drink_shop.save\n format.html { redirect_to @drink_shop, notice: 'Drink shop was successfully created.' }\n format.json { render :show, status: :created, location: @drink_shop }\n else\n format.html { render :new }\n format.json { render json: @drink_shop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fooddrink = Fooddrink.new(fooddrink_params)\n @fooddrink.user_id = current_user.id\n\n respond_to do |format|\n if @fooddrink.save\n format.html { redirect_to @fooddrink, notice: 'Food/Drink was successfully created.' }\n format.json { render :show, status: :created, location: @fooddrink }\n else\n format.html { render :new }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rink = Rink.new(params[:rink])\n\n respond_to do |format|\n if @rink.save\n format.html { redirect_to @rink, notice: 'Rink was successfully created.' }\n format.json { render json: @rink, status: :created, location: @rink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @coffee_drinker = CoffeeDrinker.new(coffee_drinker_params)\n\n respond_to do |format|\n if @coffee_drinker.save\n format.html { redirect_to @coffee_drinker, notice: 'Coffee drinker was successfully created.' }\n format.json { render :show, status: :created, location: @coffee_drinker }\n else\n format.html { render :new }\n format.json { render json: @coffee_drinker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rink = Rink.new(rink_params)\n\n respond_to do |format|\n if @rink.save\n format.html { redirect_to @rink, notice: 'Rink was successfully created.' }\n format.json { render :show, status: :created, location: @rink }\n else\n format.html { render :new }\n format.json { render json: @rink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drink_type = DrinkType.new(drink_type_params)\n\n respond_to do |format|\n if @drink_type.save\n format.html { redirect_to stock_path(@drink_type), notice: 'Drink type was successfully created.' }\n format.json { render :show, status: :created, location: @drink_type }\n else\n format.html { render :new }\n format.json { render json: @drink_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@include_drink = IncludeDrink.new(params[:include_drink])\n @order = current_order\n\n drink = Drink.find(params[:drink_id])\n @include_drink = @order.add_drink(drink.id)\n\n @order.add_drink_tax(@include_drink)\n\n if @order.price\n @order.price += drink.price\n else\n @order.price = drink.price\n end\n\n @order.save\n\n respond_to do |format|\n if @include_drink.save\n format.html { redirect_to store_url, notice: 'Include drink was successfully created.' }\n format.json { render json: @include_drink, status: :created, location: @include_drink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @include_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_drink(category, table_name, name, price, max_price, min_price, current_price, price_difference, bio)\n @bar.drinks.create(name: name, price: price, max_price: max_price, min_price: min_price, current_price: current_price, price_difference: price_difference, bio: bio, category: category,\n table_name: table_name)\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /alco_drinks/1 PATCH/PUT /alco_drinks/1.json
def update respond_to do |format| if @alco_drink.update(alco_drink_params) format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully updated.' } format.json { render :show, status: :ok, location: @alco_drink } else format.html { render :edit } format.json { render json: @alco_drink.errors, status: :unprocessable_entity } end end end
[ "def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end", "def update\n @cocktail_ingredient = CocktailIngredient.find(params[:id])\n\n respond_to do |format|\n if @cocktail_ingredient.update_attributes(params[:cocktail_ingredient])\n format.html { redirect_to @cocktail_ingredient, notice: 'Cocktail ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cocktail_ingredient.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 @fooddrink = Fooddrink.find(params[:id])\n\n respond_to do |format|\n if @fooddrink.update_attributes(params[:fooddrink])\n format.html { redirect_to @fooddrink, notice: 'Fooddrink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @drink.update(drink_params)\n format.html { redirect_to @drink, notice: 'Drink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch *args\n make_request :patch, *args\n end", "def update\n update_resource(@tomato)\n end", "def update\n @drinker = Drinker.find(params[:id])\n\n respond_to do |format|\n if @drinker.update_attributes(params[:drinker])\n format.html { redirect_to @drinker, :notice => 'Drinker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @drinker.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @meal.update(meal_params)\n head :no_content, status: 204\n else\n render json: @meal.errors, status: :unprocessable_entity \n end\n\n end", "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "def update\n respond_to do |format|\n if @cocktail.update(cocktail_params)\n if (params['cocktail']['ingredients'] != nil)\n for id in params['cocktail']['ingredients']\n @cocktail.ingredients << Ingredient.find(id)\n end\n end\n format.html {redirect_to @cocktail, notice: 'Cocktail was successfully updated.'}\n format.json {render :show, status: :ok, location: @cocktail}\n else\n format.html {render :edit}\n format.json {render json: @cocktail.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @rink = Rink.find(params[:id])\n\n respond_to do |format|\n if @rink.update_attributes(params[:rink])\n format.html { redirect_to @rink, notice: 'Rink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end", "def update\n respond_to do |format|\n if @fooddrink.update(fooddrink_params)\n format.html { redirect_to @fooddrink, notice: 'Food/Drink was successfully updated.' }\n format.json { render :show, status: :ok, location: @fooddrink }\n else\n format.html { render :edit }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def favorite\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/2/favorite'\n ).to_s\n\n puts RestClient.patch(\n url,{}\n )\nend", "def update\n @dry_fruit = DryFruit.find(params[:id])\n\n respond_to do |format|\n if @dry_fruit.update_attributes(params[:dry_fruit])\n format.html { redirect_to @dry_fruit, :notice => 'Dry fruit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @dry_fruit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "def update\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n if @books_on_loan.update_attributes(params[:books_on_loan])\n format.json { head :no_content }\n else\n format.json { render json: @books_on_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /alco_drinks/1 DELETE /alco_drinks/1.json
def destroy @alco_drink.destroy respond_to do |format| format.html { redirect_to alco_drinks_url, notice: 'Alco drink was successfully destroyed.' } format.json { head :no_content } end end
[ "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "def destroy\n @drink.destroy\n respond_to do |format|\n format.html { redirect_to drinks_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @fooddrink = Fooddrink.find(params[:id])\n @fooddrink.destroy\n\n respond_to do |format|\n format.html { redirect_to fooddrinks_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 @alcohol.destroy\n respond_to do |format|\n format.html { redirect_to alcohols_url }\n format.json { head :no_content }\n end\n end", "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "def delete\n self.class.headers 'Authorization' => \"OAuth #{ENV['sfdc_token']}\"\n self.class.headers 'Content-Type' => \"application/json\"\n response = self.class.delete(SObject.root_url+\"/sobjects/#{@object_name}/#{@Id}\")\n raise response.parsed_response[0]['message'] if response.code.to_i > 299\n nil\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @cocktail_ingredient = CocktailIngredient.find(params[:id])\n @cocktail_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktail_ingredients_url }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def delete(id, recipe_step_id)\n \trequest(:delete, \"/recipes/#{id}/recipe_steps/#{recipe_step_id}.json\")\n end", "def destroy\n @drumy = Drumy.find(params[:id])\n @drumy.destroy\n\n respond_to do |format|\n format.html { redirect_to drumies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_food = LineFood.find(params[:id])\n @line_food.destroy\n\n respond_to do |format|\n format.html { redirect_to line_foods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rink = Rink.find(params[:id])\n @rink.destroy\n\n respond_to do |format|\n format.html { redirect_to rinks_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @line_drug = LineDrug.find(params[:id])\n @line_drug.destroy\n\n respond_to do |format|\n format.html { redirect_to line_drugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n\n head :no_content\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Con un objeto de tipo MenuUsuarioTipo, arma el item del menu
def mostrar_item(menu) # Si el item tiene url, controlador o accion, arma link, sino solo label if (menu.controller != '') or (menu.action != '') or (menu.url != '') if menu.url != '' link_to menu.nombre, menu.url else link_to menu.nombre, :controller => menu.controller, :action => menu.action end else menu.nombre end end
[ "def getItemMenu( item)\n h = { \n UONConnection => @connectionItemMenu, \n\t\t\tUONCard => @cardItemMenu,\n UONPrimitive => @primitiveItemMenu\n }\n menu = @itemMenu # default return value\n if h.key?( item.class) then\n menu = h[item.class]\n end\n menu # return value\n\tend", "def obj\n\t\t\t\t@id ? Mokio::Menu.find(@id) : Mokio::Menu.find_by_name(@name)\n\t\t\tend", "def menu_item(items)\n @menu_items = items\n end", "def edit_menu(item)\n dialog_class = mapper.get_class('app.dialog.menu')\n return dialog_class.new(@app, item).invoke\n end", "def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk devices'),\n url_for(:controller => 'disk_devs')) <<\n MenuItem.new(_('Terminals'),\n url_for(:controller => 'terminals')) <<\n MenuItem.new(_('Terminal classes'),\n url_for(:controller => 'term_classes')) <<\n MenuItem.new(_('Instances'),\n url_for(:controller => 'instances')) \n\n if @sysuser.admin?\n @menu << MenuItem.new(_('User management'),\n url_for(:action => 'list', \n :controller => 'sysusers'))\n end\n end", "def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end", "def show\n @administrator_menu_nivel0_menu_nivel1 = Administrator::MenuNivel0::MenuNivel1.find(params[:id])\n @opcionMenu = Administrator::MenuNivel0.find(@administrator_menu_nivel0_menu_nivel1.administrator_menu_nivel0_id)\n end", "def new_menu_position\n @menu = Mokio::Menu.new\n end", "def menu\n @menu ||= Interface::Menu.new(self)\n end", "def build_menu(type)\n # Session Gtk::Menu\n menu_session = Gtk::Menu.new\n\n session_item_shell = Gtk::ImageMenuItem.new(\"Interact Session\")\n session_image_shell = Gtk::Image.new\n session_image_shell.set(Gtk::Stock::CONNECT, Gtk::IconSize::MENU)\n session_item_shell.set_image(session_image_shell)\n menu_session.append(session_item_shell)\n\n if (type == \"meterpreter\")\n meterpreter_separator = Gtk::SeparatorMenuItem.new\n menu_session.append(meterpreter_separator)\n\n # Meterpreter shell\n meterpreter_item_shell = Gtk::ImageMenuItem.new(\"Meterpreter Shell\")\n meterpreter_image_shell = Gtk::Image.new\n meterpreter_image_shell.set(Gtk::Stock::EXECUTE, Gtk::IconSize::MENU)\n meterpreter_item_shell.set_image(meterpreter_image_shell)\n # TODO\n # menu_session.append(meterpreter_item_shell)\n\n # sdapi/process\n meterpreter_proc_item_shell = Gtk::ImageMenuItem.new(\"Process\")\n meterpreter_proc_image_shell = Gtk::Image.new\n meterpreter_proc_image_shell.set(Gtk::Stock::INDEX, Gtk::IconSize::MENU)\n meterpreter_proc_item_shell.set_image(meterpreter_proc_image_shell)\n menu_session.append(meterpreter_proc_item_shell)\n\n # sdapi/fs\n meterpreter_fs_item_shell = Gtk::ImageMenuItem.new(\"Browse\")\n meterpreter_fs_image_shell = Gtk::Image.new\n meterpreter_fs_image_shell.set(Gtk::Stock::OPEN, Gtk::IconSize::MENU)\n meterpreter_fs_item_shell.set_image(meterpreter_fs_image_shell)\n menu_session.append(meterpreter_fs_item_shell)\n\n # Meterpreter shell signal\n meterpreter_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Console::Meterpreter.new(current)\n end\n end\n\n # Process signal\n meterpreter_proc_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Stdapi::Sys::Ps.new(current[O_SESSION])\n end\n end\n\n # Fs signal\n meterpreter_fs_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Stdapi::Fs.new(current[O_SESSION])\n end\n end\n end\n\n basic_separator = Gtk::SeparatorMenuItem.new\n menu_session.append(basic_separator)\n\n close_session_item_shell = Gtk::ImageMenuItem.new(\"Close Session\")\n close_session_image_shell = Gtk::Image.new\n close_session_image_shell.set(Gtk::Stock::CLOSE, Gtk::IconSize::MENU)\n close_session_item_shell.set_image(close_session_image_shell)\n menu_session.append(close_session_item_shell)\n\n session_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n open_session(current)\n end\n end\n\n close_session_item_shell.signal_connect('activate') do |item|\n if session_iter = @selection.selected\n remove_session_iter(session_iter)\n end\n end\n\n return menu_session.show_all\n end", "def object_menu(class_name, action)\n class_string = class_name.to_s.underscore.downcase\n create_menu = Menu.new(menu_title_hash_by_action(class_string.humanize.downcase)[action])\n all = class_name.all\n all.each_with_index do |object, x|\n create_menu.add_menu_item({user_message: get_object_display_message(object), method_name: \"#{class_string}/#{action}/#{object.id}\"})\n end\n create_menu\n end", "def createMenu _obj, _args\n \"_obj createMenu _args;\" \n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY ARITMETICO]]-----\"\n puts \"______________________________\"\n puts \"1) Suma\"\n puts \"2) Resta\"\n puts \"3) División\"\n puts \"4) Multiplicación\"\n puts \"5) Potencia\"\n puts \"6) Residuo\"\n puts \"7) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def add menu\n @items << menu\n return self\n end", "def new\n @menu_item = MenuItem.new\n end", "def addMenu _obj, _args\n \"_obj addMenu _args;\" \n end", "def menu_items\n menu.items(self)\n end", "def user_choice_of_object_in_class(class_object)\n create_menu = Menu.new(\"Which #{class_object.name} do you want to look up?\")\n all = class_object.all\n all.each_with_index do |object, x|\n create_menu.add_menu_item({key_user_returns: x + 1, user_message: object.to_s, method_name: \"#{object.id}\"})\n end\n create_menu\n end", "def menu\n mainMenu\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
any character existing in remove must be deleted from str. eg "Battle of the Vowels: Hawaii vs. Grozny" and remove "aeiou" => "Bttl f th Vwls: Hw vs. Grzny" Ruby
def remove_str(str, remove) original = str.split(//) deleted = remove.split(//) deleted.each {|char| original.delete(char)} return original.join end
[ "def remove(str, char)\n output = \"\"\n i = 0\n while i < str.length\n if str[i] != char\n output << str[i]\n end\n i += 1\n end\n return output\nend", "def remove(str, char)\n i = 0\n new_str = \"\"\n while i < str.length\n if str[i] != char\n new_str += str[i]\n end\n\n i += 1\n end\n\n return new_str\nend", "def vowels_remover2(str)\n p str.delete('aeiou') \nend", "def remove_char(string, char)\n\n word = string.split(\"\")\n j = 0\n (0...word.length).each do |i|\n if word[i] != char\n word[j] = word[i]\n j += 1\n end\n end\n return word\nend", "def remove_vowels string\n#my_splited_arra = string.split('')\n string.delete \"aeiouAEIOU\"\nend", "def strip_vowels(s)\n s.delete \"aeiouAEIOU\"\nend", "def remove(input, string); end", "def removeFromString(str, remove_str)\n n = str.length\n flags = Hash.new(false)\n remove_str.split('').each do |c|\n flags[c] = true\n end\n\n dst = 0\n for src in 0...n\n if !flags[str[src]]\n str[dst] = str[src]\n dst += 1\n end \n end\n\n puts str[0...dst] \nend", "def delete_vowel(string)\n VOWELS.each do |letter|\n if string.match(letter)\n string.delete!(letter)\n end\n end\n string\nend", "def remove(string,char)\n if char.length>1\n return \"char can't be longer than one character!\"\n end\n\n i = 0\n output=\"\"\n while i<= string.length-1\n if string[i] != char\n output += string[i]\n end\n i+=1\n end\n return output\nend", "def vowel_remover string\n# Using the .delete method, remove all the vowels from the string by passing all lowercase and uppercase vowels to the .delete method.\n# print the result\n p string.delete \"aeiouAEIOU\"\nend", "def remove_char(string, char)\n i = 0\n out = \"\"\n while i < string.length\n if string[i] != char\n out += string[i]\n i += 1\n else\n i += 1\n end\n end\n return out\nend", "def remove_string(string, characters)\n i = 0\n size = characters.length\n output = \"\"\n while i < string.length\n if string[i,size] != characters\n output << string[i]\n i += 1\n else\n i += size\n end\n end\n return output\nend", "def remove_char(string, character)\n i = 0\n output = \"\"\n while i < string.length\n if string[i] != character\n output << string[i]\n end\n i += 1\n end\n return output\nend", "def clean_substring(substring)\n substring = substring.downcase.delete \"^a-z0-9\"\n puts substring\n substring\nend", "def remove(string, chr)\n i = 0\n output = \"\"\n while i < string.length\n if string[i] != chr\n output += string[i]\n end\n i += 1\n end\n return output\nend", "def remove_str(str, substr)\n output = \"\"\n i = 0\n substrlength = substr.length\n while i < str.length\n if str[i, substrlength] == substr\n i += substrlength\n else\n output += str[i]\n i += 1\n end\n end\n return output\nend", "def remove_char(s)\n longitud = s.length\n s[1..(longitud - 2)]\nend", "def remove_substrings(str, id)\n each_substring(str) { |sub| @substrings.zrem(sub, id) }\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /early_pregnancies/1 GET /early_pregnancies/1.json
def show @early_pregnancy = EarlyPregnancy.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @early_pregnancy } end end
[ "def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def show\n @pregnancy_state = PregnancyState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pregnancy_state }\n end\n end", "def index\n @pregnancies = Pregnancy.all\n end", "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @foreign_enterprises = ForeignEnterprise.page(params[:page]).order(\"updated_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foreign_enterprises }\n end\n end", "def index\n @nations = Nation.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nations }\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n @pregnancies = @rabbit.pregnancies\n end", "def index\n @previous_parties = PreviousParty.all\n end", "def index\n @narratives = Narrative.all\n published_narratives = Narrative.where(is_published: true)\n render_to_home(narratives_json(published_narratives))\n end", "def index\n @nerds = Nerd.all\n render json: @nerds\n end", "def draft_prospects(year, **options) = get(\"/draft/#{year}/prospects\", **options)", "def index\n @pains = Pain.all\n render json: @pains\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def index\n @birthday_parties = current_user.birthday_parties\n\n render json: @birthday_parties\n end", "def show\n # render json: @birthday_party\n end", "def show\n @hot_water_production = HotWaterProduction.find(params[:id])\n @hot_water_production_years = HotWaterProductionYear.find_all_by_hotWaterProduction_id(params[:id], :order =>\"year_id DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hot_water_production }\n end\n end", "def show\n @prey = Prey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prey }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /early_pregnancies/new GET /early_pregnancies/new.json
def new @early_pregnancy = EarlyPregnancy.new respond_to do |format| format.html # new.html.erb format.json { render json: @early_pregnancy } end end
[ "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pregnancy_state = PregnancyState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pregnancy_state }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @official_neighborhood = OfficialNeighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @official_neighborhood }\n end\n end", "def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end", "def new\n @nail = Nail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nail }\n end\n end", "def new\n @nation = Nation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nation }\n end\n end", "def new\n @nationality = Nationality.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nationality }\n end\n end", "def new\n @npc = Npc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @npc }\n end\n end", "def new\n @national_rank = NationalRank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @national_rank }\n end\n end", "def new\n @neighborhood_thought = NeighborhoodThought.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood_thought }\n end\n end", "def new\n @missing_person = @event.missing_people.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missing_person }\n end\n end", "def new\n @prey = Prey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prey }\n end\n end", "def new\n @official = Official.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official }\n end\n end", "def new\n @party_set = PartySet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party_set }\n end\n end", "def new\n @anniversary = Anniversary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anniversary }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /early_pregnancies POST /early_pregnancies.json
def create @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy]) respond_to do |format| if @early_pregnancy.save format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' } format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy } else format.html { render action: "new" } format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity } end end end
[ "def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def create\n @pregnancy_state = PregnancyState.new(params[:pregnancy_state])\n\n respond_to do |format|\n if @pregnancy_state.save\n format.html { redirect_to @pregnancy_state, notice: 'Pregnancy state was successfully created.' }\n format.json { render json: @pregnancy_state, status: :created, location: @pregnancy_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pregnancy_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render :show, status: :created, location: @pregnancy }\n else\n format.html { render :new }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t@early_payment = EarlyPayment.new(early_payment_params)\n\n\trespond_to do |format|\n\t\tif @early_payment.save\n\t\t\tformat.html { redirect_to @early_payment, notice: 'Early payment was successfully created.' }\n\t\t\tformat.json { render action: 'show', status: :created, location: @early_payment }\n\t\telse\n\t\t\tformat.html { render action: 'new' }\n\t\t\tformat.json { render json: @early_payment.errors, status: :unprocessable_entity }\n\t\tend\n\tend\nend", "def update_pregnancy_state(event)\n prenatal_ppg_status_determining_events = [4,5,6,9,29,7,8,11,12]\n if prenatal_ppg_status_determining_events.include?(event.event_type.local_code)\n date = event.event_end_date.blank? ? event.event_start_date : event.event_end_date\n if known_to_be_pregnant?(date)\n if(low_intensity? && can_impregnate_low? &&\n !due_date_is_greater_than_follow_up_interval(date))\n impregnate_low!\n end\n\n if high_intensity? && can_impregnate?\n impregnate!\n end\n end\n end\n end", "def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prey = Prey.new(params[:prey])\n\n respond_to do |format|\n if @prey.save\n format.html { redirect_to @prey, notice: 'Prey was successfully created.' }\n format.json { render json: @prey, status: :created, location: @prey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prey.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def new\n @pregnancy_state = PregnancyState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pregnancy_state }\n end\n end", "def create_preapproval_payment(preapproval_payment)\r\n request(:post, \"/preapproval\", preapproval_payment)\r\n end", "def create\n @pre_enrollment = PreEnrollment.new(pre_enrollment_params)\n\n respond_to do |format|\n if @pre_enrollment.save\n format.html { redirect_to @pre_enrollment, notice: 'Pre enrollment was successfully created.' }\n format.json { render :show, status: :created, location: @pre_enrollment }\n else\n format.html { render :new }\n format.json { render json: @pre_enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n @rabbit = @pregnancy.rabbit\n @cage = @rabbit.cage\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Inizio gravidanza registrato' }\n format.json { render :show, status: :created, location: @pregnancy }\n else\n format.html { render :new }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def create\n @prequestionnaire = Prequestionnaire.new(prequestionnaire_params)\n\n respond_to do |format|\n if @prequestionnaire.save\n format.html { redirect_to thanks_path(thanks: 'prequestionnaire'), notice: 'Prequestionnaire was successfully created.' }\n format.json { render :show, status: :created, location: @prequestionnaire }\n else\n format.html { render :new }\n format.json { render json: @prequestionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @preop_risk_assessment =\n PreopRiskAssessment.new(preop_risk_assessment_params)\n @preop_risk_assessment[:surgical_profile_id] = @surgical_profile.id\n\n respond_to do |format|\n if @preop_risk_assessment.save\n format.html {\n redirect_to patient_surgical_profile_path(\n @surgical_profile.patient_id,\n @surgical_profile.id,\n :sp_view_mode =>\n SurgicalProfilesController::SP_VIEW_PREOP_ASSESSMENT\n ),\n notice: 'Preop risk assessment was successfully created.' }\n format.json { render action: 'show', status: :created,\n location: @preop_risk_assessment }\n else\n format.html { render action: 'new' }\n format.json { render json: @preop_risk_assessment.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @income = Income.new(params[:income])\n @income.budget = current_budget\n @income.generate_periods = true\n\n if @income.save\n render :json => @income.to_json(:include => :income_values), status: :created, location: @income\n else\n render json: @income.errors, status: :unprocessable_entity \n end\n\n end", "def create\n @nop_evidence = NopEvidence.new(nop_evidence_params)\n\n respond_to do |format|\n if @nop_evidence.save\n format.html { redirect_to @nop_evidence, notice: 'Nop evidence was successfully created.' }\n format.json { render :show, status: :created, location: @nop_evidence }\n else\n format.html { render :new }\n format.json { render json: @nop_evidence.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /early_pregnancies/1 PUT /early_pregnancies/1.json
def update @early_pregnancy = EarlyPregnancy.find(params[:id]) respond_to do |format| if @early_pregnancy.update_attributes(params[:early_pregnancy]) format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity } end end end
[ "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pregnancy_state = PregnancyState.find(params[:id])\n\n respond_to do |format|\n if @pregnancy_state.update_attributes(params[:pregnancy_state])\n format.html { redirect_to @pregnancy_state, notice: 'Pregnancy state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pregnancy_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def update\n respond_to do |format|\n puts \"pregnancy_params => #{pregnancy_params}\"\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @pre_application = PreApplication.create(\n organisation_id: current_user.organisations.first.id,\n user_id: current_user.id\n )\n \n PaExpressionOfInterest.create(pre_application_id: @pre_application.id)\n \n redirect_to(\n pre_application_expression_of_interest_heritage_focus_path(\n @pre_application.id\n )\n )\n \n end", "def update\n respond_to do |format|\n if @early_signup.update(early_signup_params)\n format.html { redirect_to @early_signup, notice: 'Early signup was successfully updated.' }\n format.json { render :show, status: :ok, location: @early_signup }\n else\n format.html { render :edit }\n format.json { render json: @early_signup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n get_event\n @event_prerequisite = @event.prerequisites.find(params[:id])\n @event_prerequisite.update_attributes(params[:event_prerequisite])\n\n respond_to do |format|\n format.json { respond_with_bip(@event_prerequisite) }\n end\n end", "def update\n respond_to do |format|\n if @pregnancy_control.update(pregnancy_control_params)\n format.html { redirect_to @pregnancy_control, notice: \"Pregnancy control was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pregnancy_control }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pregnancy_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @official_tenure = OfficialTenure.find(params[:id])\n\n respond_to do |format|\n if @official_tenure.update_attributes(params[:official_tenure])\n format.html { redirect_to @official_tenure, notice: 'Official tenure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @official_tenure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @precatory.update(precatory_params)\n format.html { redirect_to precatories_path, notice: 'Precatory was successfully updated.' }\n format.json { render :show, status: :ok, location: @precatory }\n else\n format.html { render :edit }\n format.json { render json: @precatory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\trespond_to do |format|\n\t\tif @early_payment.update(early_payment_params)\n\t\t\tformat.html { redirect_to @early_payment, notice: 'Early payment was successfully updated.' }\n\t\t\tformat.json { head :no_content }\n\t\telse\n\t\t\tformat.html { render action: 'edit' }\n\t\t\tformat.json { render json: @early_payment.errors, status: :unprocessable_entity }\n\t\tend\n\tend\nend", "def update_pregnancy_state(event)\n prenatal_ppg_status_determining_events = [4,5,6,9,29,7,8,11,12]\n if prenatal_ppg_status_determining_events.include?(event.event_type.local_code)\n date = event.event_end_date.blank? ? event.event_start_date : event.event_end_date\n if known_to_be_pregnant?(date)\n if(low_intensity? && can_impregnate_low? &&\n !due_date_is_greater_than_follow_up_interval(date))\n impregnate_low!\n end\n\n if high_intensity? && can_impregnate?\n impregnate!\n end\n end\n end\n end", "def update\n @competence.update!(competence_params)\n render json: {status: :ok}\n end", "def update\n respond_to do |format|\n if @pre_enrollment.update(pre_enrollment_params)\n format.html { redirect_to @pre_enrollment, notice: 'Pre enrollment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_enrollment }\n else\n format.html { render :edit }\n format.json { render json: @pre_enrollment.errors, status: :unprocessable_entity }\n end\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /early_pregnancies/1 DELETE /early_pregnancies/1.json
def destroy @early_pregnancy = EarlyPregnancy.find(params[:id]) @early_pregnancy.destroy respond_to do |format| format.html { redirect_to early_pregnancies_url } format.json { head :no_content } end end
[ "def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to pregnancies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pregnancy_state = PregnancyState.find(params[:id])\n @pregnancy_state.destroy\n\n respond_to do |format|\n format.html { redirect_to pregnancy_states_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza rimossa con successo' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prey = Prey.find(params[:id])\n @prey.destroy\n\n respond_to do |format|\n format.html { redirect_to preys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @narrative = Narrative.find(params[:id])\n @narrative.destroy\n\n respond_to do |format|\n format.html { redirect_to narratives_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @natural_client.destroy\r\n respond_to do |format|\r\n format.html { redirect_to natural_clients_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @json.destroy\n\n head :no_content\n end", "def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @apportionment_per_greenhouse.destroy\n respond_to do |format|\n format.html { redirect_to apportionment_per_greenhouses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prepod = Prepod.find(params[:id])\n @prepod.destroy\n\n respond_to do |format|\n format.html { redirect_to prepods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @natural_resource_typology.destroy\n respond_to do |format|\n format.html { redirect_to natural_resource_typologies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @yearly_detail = YearlyDetail.find(params[:id])\n @yearly_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n @thirtynine.destroy\n respond_to do |format|\n format.html { redirect_to thirtynines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nineteen.destroy\n respond_to do |format|\n format.html { redirect_to nineteens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prescription = Prescription.find(params[:id])\n @prescription.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @nfi_pregnancy_category.destroy\n respond_to do |format|\n format.html { redirect_to nfi_pregnancy_categories_url, notice: 'Nfi pregnancy category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nutrition_client = NutritionClient.find(params[:id])\n @nutrition_client.destroy\n\n respond_to do |format|\n format.html { redirect_to nutrition_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The main view. This method builds the layout and returns the root view.
def view unless is_parent_layout? return parent_layout.view end @view ||= build_view end
[ "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def createMainLayout()\n\t\t@header = createHeaderLayout()\n\t\t@content = createContentLayout()\n\n\t\t@main = Gtk::Box.new(:vertical, 2)\n\t\t@main.pack_start(@header)\n\t\t@main.pack_start(@content, :expand => true, :fill => true)\n\n\t\tself.children.each do |child|\n\t\t\tself.remove(child)\n\t\tend\n\n\t\tself.add(@main)\n\t\treturn self\n\tend", "def get_layout\n template = Erubis::Eruby.new File.read(\"#{ROOT}/app/views/layout/application.html.erb\")\n template.result(binding)\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def view\n @view ||= returning Cell::View.new(view_paths, {}, @controller) do |v|\n v.cell = self\n v.helper_module = self.class.master_helper_module\n end\n end", "def view_root\n [ @view_root,\n root/@view_root,\n root/'template',\n ].find{|path| File.directory?(path) } || @view_root\n end", "def populate_view(root_view, view_store, view_info)\n root_view.containers.each {|e|\n next unless path = view_info[e[:name]]\n\n v = self.populate_view(View.new(path, view_store), view_store, view_info)\n v.context = @context\n v.composer = @composer\n self.reset_container(e[:doc])\n self.add_content_to_container(v, e[:doc])\n }\n root_view\n end", "def layout\n layout_for(current_page_number)\n end", "def view_root *args\n if args.empty?\n @view_root\n else\n check_path(\"#{self}.view_root: '%s' doesn't exist\", *args)\n @view_root = args.flatten\n end\n end", "def root\n Tk.init\n @root\n end", "def content\n view_context.content_for(:layout)\n end", "def _layout; end", "def create_main_ui\n @main_ui = MainUI.new(@viewport)\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def with_local_root(local_root)\n View.new(@global_root, local_root)\n end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def layout_contents\n layout.render(self)\n end", "def layout\n unless set_layout\n if parent?\n parent.child_layout ? parent.child_layout : parent.layout\n end\n else\n set_layout\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the layout has been built yet or not.
def built? !@view.nil? end
[ "def components_pending?\n not layout.components.empty?\n end", "def layout_exists?(layout); end", "def place_in_layout?\n !(asset_file? || yaml_file? || no_layout?)\n end", "def place_in_layout?\n !(asset_file? || no_layout?)\n end", "def build?(file)\n !partial?(file) && !layout?(file)\n end", "def is_built?\n return @built\n end", "def built?\n @built = false if @built.nil?\n @built\n end", "def building?\n !build_stack.empty?\n end", "def built?\n exists? && true_if_nil(template_loaded?) &&\\\n true_if_nil(fixtures_loaded?)\n end", "def layout_exists?(layout)\n !site.layouts[layout].nil?\n end", "def invalid_layout?(layout); end", "def layout_set?\n (@layout!=nil) and (@thumbsize!=nil)\n \n end", "def layout_available?(layout)\n !layout[\"hide\"] && !already_taken?(layout) && available_on_site?(layout)\n end", "def standalone_layout?\n layout.is_a?(String) && layout.start_with?('thredded/')\n end", "def in_layout_view?\n @view && @view.superview.kind_of?(LayoutView)\n end", "def action_has_layout?; end", "def views_initialized?\n @_views_initialized\n end", "def built?\n Namespace.root.executed_blueprints.include?(self)\n end", "def unresolved_components? \n ! unresolved_components.empty?\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
just in case Assign a view to act as the 'root' view for this layout. This method can only be called once, and must be called before `add` is called for the first time (otherwise `add` will create a default root view). This method must be called from inside `layout`, otherwise you should just use `create`. You can also call this method with just an element_id, and the default root view will be created.
def root(element, element_id=nil, &block) if @view raise ContextConflictError.new("Already created the root view") end unless @assign_root raise InvalidRootError.new("You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)") end @assign_root = false # this method can be called with just a symbol, to assign the root element_id if element.is_a?(Symbol) element_id = element # See note below about why we don't need to `apply(:default_root)` element = preset_root || default_root elsif preset_root && preset_root != element # You're trying to make two roots, one at initialization # and one in your layout itself. raise ContextConflictError.new("Already created the root view") end @view = initialize_element(element, element_id) if block if @context raise ContextConflictError.new("Already in a context") end end style_and_context(@view, element_id, &block) return @view end
[ "def root(element, element_id=nil, &block)\n if element && element.is_a?(NSString)\n element = NSMenu.alloc.initWithTitle(element)\n end\n super(element, element_id, &block)\n end", "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def add_view\n super\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def view_root *args\n if args.empty?\n @view_root\n else\n check_path(\"#{self}.view_root: '%s' doesn't exist\", *args)\n @view_root = args.flatten\n end\n end", "def populate_view(root_view, view_store, view_info)\n root_view.containers.each {|e|\n next unless path = view_info[e[:name]]\n\n v = self.populate_view(View.new(path, view_store), view_store, view_info)\n v.context = @context\n v.composer = @composer\n self.reset_container(e[:doc])\n self.add_content_to_container(v, e[:doc])\n }\n root_view\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def populate_view(root_view, view_info)\n root_view.containers.each {|e|\n next unless path = view_info[e[:name]]\n \n v = self.populate_view(View.new(path), view_info)\n self.reset_container(e[:doc])\n self.add_content_to_container(v, e[:doc])\n }\n root_view\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def default_view\n @_visual_child.default_view\n end", "def root_element\n @root_element = true\n singleton_element\n end", "def _layout; end", "def initialize_view\n return unless @view.nil?\n @view = View.instance\n end", "def sub_layout\n 'empty'\n end", "def with_local_root(local_root)\n View.new(@global_root, local_root)\n end", "def addSubview view\n super\n if view.respond_to? :layout\n relayout!\n else\n raise ArgumentError, \"view #{view} does not support the #layout method\"\n end\n end", "def create_first_view\n # copy the default ministry's first view if possible\n if Cmt::CONFIG[:default_ministry_name] && \n ministry = Ministry.find(:first, :conditions => { _(:name, :ministry) => Cmt::CONFIG[:default_ministry_name] } )\n view = ministry.views.first\n else\n # copy the first view in the system if there is one\n view = View.find(:first, :order => _(:ministry_id, :view))\n end\n\n if view\n new_view = view.clone\n new_view.ministry_id = self.id\n new_view.save!\n views << new_view\n view.view_columns.each do |view_column|\n new_view.view_columns.create! :column_id => view_column.column_id\n end\n #if that doesn't exist, make a new view will have every column\n else\n new_view = View.create!(:title => \"default\", :ministry_id => self.id)\n Column.all.each do |c|\n new_view.columns << c\n end\n end\n new_view.default_view = true\n new_view.save!\n new_view\n end", "def layouts=(_arg0); end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the style method of all objects in the view hierarchy that are part of this layout. The views in a child layout are not styled, but those layouts will receive a `reapply!` message if no root is specified.
def reapply! root ||= self.view @layout_state = :reapply run_reapply_blocks @child_layouts.each do |child_layout| child_layout.reapply! end @layout_state = :initial return self end
[ "def reapply!\n root ||= self.view\n @layout_state = :reapply\n\n @elements.each do |element_id, elements|\n elements.each do |element|\n style_and_context(element, element_id)\n end\n end\n\n @child_layouts.each do |child_layout|\n child_layout.reapply!\n end\n\n @layout_state = :initial\n\n return self\n end", "def reapply_styles\n selected.each do |selected_view|\n selected_view.rmq_data.styles.each do |style_name|\n apply_style_to_view selected_view, style_name\n end\n end\n self\n end", "def restyle!\n top_level_view.stylesheet = stylesheet\n end", "def perform_layout\n @needs_layout = false\n @subviews.each(&:perform_layout)\n end", "def apply_styles(*widget)\n widget = widget.first || Gas.main\n\n widget.style_context.add_provider(self.css, Gtk::StyleProvider::PRIORITY_USER)\n return unless widget.respond_to?(:children)\n widget.children.each{|x| apply_styles(x)}\n end", "def layout_children\n @children.each { |c| c.layout }\n end", "def viewDidLoad\n # look for a layout_definition in the list of ancestors\n layout_definition = nil\n my_stylesheet = self.stylesheet\n parent_class = self.class\n while parent_class != NSObject and not (layout_definition && my_stylesheet)\n if not my_stylesheet and parent_class.respond_to?(:stylesheet)\n my_stylesheet = parent_class.stylesheet\n end\n\n if not layout_definition and parent_class.respond_to?(:layout_definition)\n layout_definition = parent_class.layout_definition\n end\n parent_class = parent_class.superclass\n end\n\n should_restyle = Teacup.should_restyle_and_block\n\n if my_stylesheet and not self.stylesheet\n self.stylesheet = my_stylesheet\n end\n\n if layout_definition\n stylename, properties, block = layout_definition\n layout(view, stylename, properties, &block)\n end\n\n if should_restyle\n Teacup.should_restyle!\n self.view.restyle!\n end\n\n if defined? NSLayoutConstraint\n self.view.apply_constraints\n end\n\n layoutDidLoad\n end", "def teacupDidLoad\n # look for a layout_definition in the list of ancestors\n layout_definition = nil\n my_stylesheet = self.stylesheet\n parent_class = self.class\n while parent_class != NSObject and not (layout_definition && my_stylesheet)\n if not my_stylesheet and parent_class.respond_to?(:stylesheet)\n my_stylesheet = parent_class.stylesheet\n end\n\n if not layout_definition and parent_class.respond_to?(:layout_definition)\n layout_definition = parent_class.layout_definition\n end\n parent_class = parent_class.superclass\n end\n\n should_restyle = Teacup.should_restyle_and_block\n\n if my_stylesheet and not self.stylesheet\n self.stylesheet = my_stylesheet\n end\n\n if layout_definition\n stylename, properties = layout_definition\n layout(top_level_view, stylename, properties)\n end\n\n if respond_to?(:teacup_layout)\n teacup_layout\n end\n\n layoutDidLoad\n\n if should_restyle\n Teacup.should_restyle!\n self.top_level_view.restyle!\n end\n\n if defined?(NSLayoutConstraint)\n self.top_level_view.apply_constraints\n end\n end", "def style_and_context(element, element_id, &block)\n style_method = \"#{element_id}_style\"\n if parent_layout.respond_to?(style_method) || block_given?\n parent_layout.context(element) do\n if parent_layout.respond_to?(style_method)\n parent_layout.send(style_method)\n end\n\n if block_given?\n yield\n end\n end\n end\n end", "def remove_all_views\n subviews.each { |view| view.removeFromSuperview }\n relayout!\n end", "def stylesheet=(new_stylesheet)\n @stylesheet = new_stylesheet\n restyle!\n subviews.each{ |subview| subview.stylesheet = new_stylesheet }\n end", "def apply_to(obj)\n entries.each do |selector, style|\n obj.style.set(style) if selector[obj]\n end\n end", "def repaint_all_widgets\n $log.debug \" REPAINT ALL in FORM called \"\n @widgets.each do |w|\n next if w.visible == false\n next if w.class.to_s == \"Canis::MenuBar\"\n $log.debug \" ---- REPAINT ALL #{w.name} \"\n #w.repaint_required true\n w.repaint_all true\n w.repaint\n end\n $log.debug \" REPAINT ALL in FORM complete \"\n # place cursor on current_widget \n setpos\n end", "def generate\n return if @widget.window.nil?\n @inherited_style.clear\n superclasses(@widget).reverse.collect{|c| c = c.name[/[^\\:]+$/].to_sym }.\n unshift(:default).each{|c|\n @inherited_style.merge!( @widget.window.stylesheet[c] ){|k,v1,v2| v2.nil? ? v1 : v2} unless @widget.window.stylesheet[c].nil?\n }\n @style = @inherited_style.merge(@given_style){|k,v1,v2| v2.nil? ? v1 : v2}\n @valid = true\n return self\n end", "def layout\n unless set_layout\n if parent?\n parent.child_layout ? parent.child_layout : parent.layout\n end\n else\n set_layout\n end\n end", "def style(*queries)\n # do not modify queries, it gets passed to `super`\n if queries[-1].is_a? Hash\n properties = queries[-1]\n else\n # empty style declarations are allowed, but accomplish nothing.\n return\n end\n\n if properties.include?(:when_contained_in)\n # okay NOW modify queries\n queries.pop\n queries.each do |stylename|\n style = Style.new\n style.stylename = stylename\n style.stylesheet = self\n style.merge!(properties)\n\n when_contained_in << [stylename, style]\n end\n else\n super\n end\n end", "def render_all(sx, sy, ws, hs, &block)\n render sx, sy, ws, hs do |r, l|\n yield r, l\n prect = apply_content_paddings(r, ws, hs)\n @children.each do |itm|\n itm.render_all(prect.x, prect.y, prect.w, prect.h, &block)\n end\n end\n end", "def pick_layout(options)\n result = super\n options[:toplevel_render_with_layout] = true if result\n result\n end", "def apply_children\n \n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Just like `last`, but if `last` returns a Layout, this method returns the layout's view.
def last_view(element_id) element = last(element_id) if element.is_a?(Layout) element = element.view end element end
[ "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def find\n self.class.find(@view.layout)\n end", "def layout\n lookup_layout\n end", "def layout \n return @layout\n end", "def parent_layout(of_layout: nil)\n layout = of_layout || current_layout\n layout_index = layout_hierarchy.find_index(layout)\n return nil if layout_index.nil? || layout_index == 0\n\n layout_hierarchy[layout_index - 1]\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def parent_layout\n\t \t\tlayout.parent_layout\n\t \tend", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def view_last\n return @vassals[-1].view_last\n end", "def layout\n Newsletter::Layout.where(id: self.layout_id).first\n end", "def current_layout\n controller.send :_layout # private method\n end", "def active_layout(passed_layout = nil)\n layout = passed_layout || self.class.read_inheritable_attribute(\"layout\")\n active_layout = case layout\n when Symbol then send(layout)\n when Proc then layout.call(self)\n when String then layout\n end\n active_layout.include?(\"/\") ? active_layout : \"layouts/#{active_layout}\" if active_layout\n end", "def current_layout\n controller.send(:_layout).to_sym\n end", "def view\n @view ? @view : (parent ? parent.view : nil)\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Resource:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def layout\n unless set_layout\n if parent?\n parent.child_layout ? parent.child_layout : parent.layout\n end\n else\n set_layout\n end\n end", "def layout_template_type\n return @layout_template_type\n end", "def layout\n\t \t\treturn @layout if @layout\n\t \t\tcnf = get_config\n\t \t\treturn unless cnf[:layout]\n\t \t\t@layout = Rfm::Factory.layout(cnf).sublayout\n\t \t\t\n\t \t\t# Added by wbr to give config heirarchy: layout -> model -> sublayout\n\t \t\tconfig :parent=>'parent_layout'\n\t \t\t@layout.config :parent=>'model'\n\t \t\t\n\t\t\t\t@layout.model = self\n\t\t\t\t@layout\n\t \tend", "def pos\n @layout[@pos - 1]\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all the elements with a given element_id
def all(element_id) unless is_parent_layout? return parent_layout.all(element_id) end @elements[element_id] || [] end
[ "def find(id)\n @elements.find { |element| element.id == id}\n end", "def get_element id\n @elements[id.to_s]\n end", "def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end", "def get id\n get_single id\n @elements[id]\n end", "def include?( element_id )\n self.elements_ids.include?( element_id )\n end", "def get_elements(xpath); end", "def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end", "def find_elements(element_name, response)\n response.body.xpath(\".//x:#{element_name}\", 'x' => response.body.namespace.href)\n end", "def get_elements( xpath )\n @elements.to_a( xpath )\n end", "def find_element_timed(element_id)\n @find_element_timer.time do\n find_element(@element_locator, element_id)\n end\n end", "def find_element_for(key)\r\n @elements.find { |e| e.includes?(key) }\r\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def elements_by_xpath(xpath)\n @browser.elements_by_xpath(xpath)\nend", "def get_element_value(element_id)\n end", "def feed_elements\n elements.find_all_by_name(definition['feed_elements'])\n end", "def data_element(id)\n DataElement.find(@server, id: id, context: {\n all: lambda { data_elements },\n any: lambda { data_elements.first },\n new: lambda { DataElement.fake(property: self) },\n })\n end", "def search_by_id(id)\n @data.each do |item|\n return item if item.id == id\n end\n\n nil\n end", "def visibility_affecting_element_ids\n return @visibility_affecting_element_ids if @visibility_affecting_element_ids\n\n # the form doesn't change much so caching on the last updated element will\n # provide a good balance of speed and cache invalidation\n Rails.cache.fetch([self, 'element#visibility_affecting_element_ids', Fe::Element.order('updated_at desc, id desc').first]) do\n elements = []\n\n elements << question_grid if question_grid\n elements << choice_field if choice_field\n elements += Fe::Element.where(conditional_type: 'Fe::Element', conditional_id: id)\n element_ids = elements.collect(&:id) +\n elements.collect { |e| e.visibility_affecting_element_ids }.flatten\n element_ids.uniq\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Just like `nth`, but if `nth` returns a Layout, this method returns the layout's view.
def nth_view(element_id, index) element = nth(element_id) if element.is_a?(Layout) element = element.view end element end
[ "def find\n self.class.find(@view.layout)\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def layout\n lookup_layout\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def parent_layout(of_layout: nil)\n layout = of_layout || current_layout\n layout_index = layout_hierarchy.find_index(layout)\n return nil if layout_index.nil? || layout_index == 0\n\n layout_hierarchy[layout_index - 1]\n end", "def layout \n return @layout\n end", "def layout\n Newsletter::Layout.where(id: self.layout_id).first\n end", "def call_layout\n if method(:_layout).arity == 1\n # Rails 5?\n _layout([:html])\n else\n # < Rails 5?\n _layout\n end\n end", "def layout\n\t \t\treturn @layout if @layout\n\t \t\tcnf = get_config\n\t \t\treturn unless cnf[:layout]\n\t \t\t@layout = Rfm::Factory.layout(cnf).sublayout\n\t \t\t\n\t \t\t# Added by wbr to give config heirarchy: layout -> model -> sublayout\n\t \t\tconfig :parent=>'parent_layout'\n\t \t\t@layout.config :parent=>'model'\n\t \t\t\n\t\t\t\t@layout.model = self\n\t\t\t\t@layout\n\t \tend", "def current_layout\n controller.send :_layout # private method\n end", "def layout_for(document); end", "def layout(value = nil)\n if value.nil?\n Rendering::LayoutFinder.find(@layout, @namespace)\n else\n @layout = value\n end\n end", "def parent_layout\n\t \t\tlayout.parent_layout\n\t \tend", "def layout\n layout_for(current_page_number)\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def pos\n @layout[@pos - 1]\n end", "def current_layout\n controller.send(:_layout).to_sym\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This searches for the "nearest" view with a given id. First, all child views are checked. Then the search goes up to the parent view, and its child views are checked. This means any view that is in the parent view's hierarchy is considered closer than a view in a grandparent's hierarchy. This is a "depthfirst" search, so any subview that contains a view with the element id ABCD Starting at D, E is closer than F, because D&E are siblings. \ \ \E But F, G and H are closer than A or I, because they share a \ \FG closer parent (B). The logic is, "B" is a container, and \I \H all views in that container are in a closer family.
def nearest(element_id) nearest(element_id, from: target) end
[ "def parent_of(id)\n item = find_by_id(id)\n find_by_id(eval(comparision_childrem_value(\"item\")))\n end", "def nearest_child\n c = nil\n children.each do |n|\n c=n if not c or distance(n)<distance(c)\n end\n c\n end", "def findCloserNode(target_id, joining_id)\n distance = (@id - target_id).abs # Determine how close node is to target\n closest_ip = nil # The node itself is currently closest to target\n\n # Check if a node in routing table is closer than this node\n @routing_table.each do |x|\n if (x[:node_id] - target_id).abs < distance && x[:node_id] != joining_id # If entry is closer than current closest\n distance = (x[:node_id] - target_id).abs # Make this entry the new closest\n closest_ip = x[:ip_address] # Get IP address of node closest to target\n end\n end\n\n return closest_ip # Return IP of closest node in routing table to target\n end", "def closest(id, wanted=3)\n # to make the sorting more efficient, let's precompute the distance once and make a hash with distance and peer\n map = @buckets.map { |peer| { :distance => NodeManager.xor_distance(peer.hash_i, id), :peer => peer } }\n # TODO: should this be d1 <=> d2, or d2 <=> d1 ? I don't understand if we want the closest or furthest peer in the kbucket\n # sort by the distance and return up to the wanted number of peers\n map.sort { |d1, d2| d2[:distance] <=> d1[:distance] }.map { |dist| dist[:peer] }[0, wanted]\n end", "def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n return this_view if this_view.is_a? type\n this_view = this_view.superview\n end\n nil\n end", "def get_closest_node(id, num = 1)\n @link_table.closest_peers(id, num)\n end", "def find_closest_child(node)\r\n # if node has no children yet\r\n return nil if @children.length == 0\r\n \r\n # calculate distance between each children and given node\r\n distances = @children.map do |child|\r\n Distances.send(@config.distance_metric, child, node)\r\n end\r\n \r\n # find the index of a child, whose distance to node is lowest\r\n distances.each_with_index.min_by { |with_index| with_index[0] } [1]\r\n end", "def compare_id(element)\n \t\tresult = 0\n\n \t\tif match_id?(@id) && match_id?(element.id)\n \t\t\tid = @id.split('_').map(&:to_i)\n \t\t\tel_id = element.id.split('_').map(&:to_i)\n\n \t\t\tif id.size <= el_id.size\n \t\t\t\tid_a = id\n \t\t\t\tid_b = el_id\n \t\t\telse\n \t\t\t\tid_a = el_id\n \t\t\t\tid_b = id\n \t\t\tend\n\n \t\t\tid_a.each_with_index do |num, i|\n \t\t\t\tif num < id_b[i]\n \t\t\t\t\tresult = -1\n \t\t\t\t\tbreak\n \t\t\t\telsif num > id_b[i]\n \t\t\t\t\tresult = 1\n \t\t\t\t\tbreak\n \t\t\t\tend\n \t\t\tend\n\n \t\t\t# case where element is child of self (or vice versa)\n \t\t\tif result == 0 && id.size != el_id.size\n \t\t\t\tresult = -1\n \t\t\tend\n\n \t\t\tif (id.size > el_id.size && result != 0)\n \t\t\t\t# negate results\n \t\t\t\tresult = - result\n \t\t\tend\n\n \t\telse\n \t\t\tresult = -2\n \t\tend\n\n \t\treturn result\n \tend", "def find_by_parent(id, parent)\n entity = find_entity(id.to_i, parent)\n from_entity(entity)\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_by_id(id)\n children.find { |child| child[:tab_id] == id }\n end", "def direct_child_by_id(id, scope = {})\n direct_children_by_id(id, scope).first\n end", "def nearest\n @tree.leaves(parent) - [self]\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_by_id(id)\n @nodes.find { |node| node.id == id }\n end", "def find_first_parent_tweet(tweet_id)\n begin\n rate_limit(:find_first_parent_tweet__internal) {\n tweet = @lisa.client.status(tweet_id)\n puts \"[#{tweet.uri}, R?=#{tweet.reply?}] #{tweet.text}\"\n return (not tweet.nil? and tweet.reply? == true) ? find_first_parent_tweet(tweet.in_reply_to_status_id) : tweet \n }\n rescue\n return nil\n end\n end", "def node(id)\r\n if id.start_with? '*'\r\n ai = id[1..-1]\r\n return find {|n| n.id.end_with? ai}\r\n end\r\n find{|n| n.id.eql? id}\r\n end", "def find_nearest_place_id max_dist\n\t#byebug\n\tphot=self.class.find(@id) #returns instance of photo\n\tphot_loc=phot.location #gets location from photo (point where photo was taken)\n\tphot_place=Place.near(phot_loc,max_dist).projection(:_id=>1).first #find closest place to point\n\tphot_place.nil? ? nil : phot_place[:_id] #return the id of the closest place to that point\nend", "def find_nearest_parent(target_class)\n columns = ['id', 'parent_id', 'construct_id', 'construct_type']\n columns_joined = columns.join(',')\n sql =\n <<-SQL\n WITH RECURSIVE control_constructs_tree (#{columns_joined}, level)\n AS (\n SELECT\n #{columns_joined},\n 0\n FROM control_constructs\n WHERE construct_id = #{id}\n AND construct_type = '#{self.class.name}'\n\n UNION ALL\n SELECT\n #{columns.map { |col| 'cat.' + col }.join(',')},\n ct.level + 1\n FROM control_constructs cat, control_constructs_tree ct\n WHERE cat.id = ct.parent_id\n )\n SELECT #{target_class.table_name}.*\n FROM control_constructs_tree\n INNER JOIN #{target_class.table_name} ON #{target_class.table_name}.id = control_constructs_tree.construct_id\n WHERE level > 0\n AND construct_type = '#{target_class.name}'\n ORDER BY level, control_constructs_tree.id, construct_id, construct_type\n LIMIT 1;\n SQL\n target_class.find_by_sql(sql.chomp).first\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a view from the list of elements this layout is "tracking", but leaves it in the view hierarchy. Returns the views that were removed.
def forget(element_id) unless is_parent_layout? return parent_layout.remove(element_id) end removed = nil context(self.view) do removed = all(element_id) @elements[element_id] = nil end removed end
[ "def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end", "def remove_all_views\n subviews.each { |view| view.removeFromSuperview }\n relayout!\n end", "def remove_view view\n unless subviews.include? view\n raise ArgumentError, \"view #{view} not a subview of this LayoutView\"\n end\n view.removeFromSuperview\n relayout!\n end", "def remove(*widgets)\n widgets.each{|widget|\n next unless widget.is_a?(Widget) || widget.is_a?(Container)\n @children.delete(widget)\n self.trigger(:child_removed, widget)\n widget.parent = nil\n widget.trigger(:removed, self)\n if !self.window.nil?\n widget.window = nil\n widget.trigger(:removed_from_window, self.window)\n window.trigger(:descendant_removed, widget)\n end\n }\n return widgets.length==1? widgets[0] : widgets\n end", "def remove_view(listener)\n @views.remove listener\n end", "def remove_views\n FileUtils.rm_rf(File.dirname(__FILE__) + \"/views\")\n end", "def remove_views *args\n options = last_option args\n raise ArgumentError, \"Missing :folder option in the last argument which must be a Hash\" if !options && !options[:folder]\n args.to_symbols.each{|name| remove_view name, options}\n end", "def remove_view(child_view)\n @child_views.delete(child_view)\n\n main_handle.remove(child_view.main_handle)\n end", "def remove_parent_and_children_views(parent_relation)\n children_views = query(<<~SQL).map{|row| row[0]}\n SELECT child_aggregate_view\n FROM updateable_views_inheritance\n WHERE parent_relation = '#{parent_relation}'\n SQL\n children_views.each do |cv|\n remove_parent_and_children_views(cv)\n # drop the view only if it wasn't dropped beforehand in recursive call from other method.\n drop_view(cv) if is_view?(cv)\n end\n drop_view(parent_relation) if is_view?(parent_relation)\n end", "def hide\n if container_view\n container_view.hidden = true\n end\n elements_to_render.values.each(&:hide)\n end", "def remove_unwanted_views\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end", "def remove_widget widget\n @widgets.delete widget\n @focusables.delete widget\n end", "def pop()\n LVGL.ffi_call!(self.class, :remove_all_objs, @self_pointer)\n @focus_groups_stack.pop()\n @focus_groups_stack.last.each do |obj|\n _add_obj(obj)\n end\n focus_obj(@last_focused_in_stack.pop())\n @focus_handler_proc_stack.pop()\n _set_focus_handler(@focus_handler_proc_stack.last)\n end", "def remove_elements(elements)\n elements.each { |e| e.remove }\n end", "def remove_component_at(index:)\n component = @child_components.delete_at(index)\n\n @view.remove_view(component.view)\n\n component\n end", "def waypoints_minus_removed\n points = []\n waypoints.each do |waypoint|\n points << waypoint if !waypoint.marked_for_destruction?\n end\n points\n end", "def remove(*nodes)\n updated(nil, children - nodes)\n end", "def remove_plot!(position = -1)\n @plots = @plots.delete_at(position)\n self\n end", "def reset_views\n @views = []\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method builds the layout and returns the root view.
def build_view # Only in the 'layout' method will we allow default container to be # created automatically (when 'add' is called) @assign_root = true prev_should_run = @should_run_deferred @should_run_deferred = true layout unless @view if @assign_root create_default_root_context @view = @context else NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?') end end run_deferred(@view) @should_run_deferred = prev_should_run @assign_root = false # context can be set via the 'create_default_root_context' method, which # may be outside a 'context' block, so make sure to restore context to # it's previous value @context = nil if @preset_root @view = WeakRef.new(@view) @preset_root = nil end @view end
[ "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def get_layout\n template = Erubis::Eruby.new File.read(\"#{ROOT}/app/views/layout/application.html.erb\")\n template.result(binding)\n end", "def layout\n layout_for(current_page_number)\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def view_root\n [ @view_root,\n root/@view_root,\n root/'template',\n ].find{|path| File.directory?(path) } || @view_root\n end", "def layout \n return @layout\n end", "def layout\n lookup_layout\n end", "def createMainLayout()\n\t\t@header = createHeaderLayout()\n\t\t@content = createContentLayout()\n\n\t\t@main = Gtk::Box.new(:vertical, 2)\n\t\t@main.pack_start(@header)\n\t\t@main.pack_start(@content, :expand => true, :fill => true)\n\n\t\tself.children.each do |child|\n\t\t\tself.remove(child)\n\t\tend\n\n\t\tself.add(@main)\n\t\treturn self\n\tend", "def _layout; end", "def layout\n unless set_layout\n if parent?\n parent.child_layout ? parent.child_layout : parent.layout\n end\n else\n set_layout\n end\n end", "def content\n view_context.content_for(:layout)\n end", "def load_layout_template\n\t\ttemplate = self.load_template( 'layout.tmpl' )\n\n\t\ttemplate.files = @files\n\t\ttemplate.classes = @classes\n\t\ttemplate.methods = @methods\n\t\ttemplate.modsort = @modsort\n\t\ttemplate.rdoc_options = @options\n\n\t\ttemplate.rdoc_version = RDoc::VERSION\n\t\ttemplate.fivefish_version = Fivefish.version_string\n\n\t\treturn template\n\tend", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def populate_view(root_view, view_store, view_info)\n root_view.containers.each {|e|\n next unless path = view_info[e[:name]]\n\n v = self.populate_view(View.new(path, view_store), view_store, view_info)\n v.context = @context\n v.composer = @composer\n self.reset_container(e[:doc])\n self.add_content_to_container(v, e[:doc])\n }\n root_view\n end", "def layout\n\t \t\treturn @layout if @layout\n\t \t\tcnf = get_config\n\t \t\treturn unless cnf[:layout]\n\t \t\t@layout = Rfm::Factory.layout(cnf).sublayout\n\t \t\t\n\t \t\t# Added by wbr to give config heirarchy: layout -> model -> sublayout\n\t \t\tconfig :parent=>'parent_layout'\n\t \t\t@layout.config :parent=>'model'\n\t \t\t\n\t\t\t\t@layout.model = self\n\t\t\t\t@layout\n\t \tend", "def layout_contents\n layout.render(self)\n end", "def view_root *args\n if args.empty?\n @view_root\n else\n check_path(\"#{self}.view_root: '%s' doesn't exist\", *args)\n @view_root = args.flatten\n end\n end", "def root\n Tk.init\n @root\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the `_style` method with the element as the context, and runs the optional block in that context. This is usually done immediately after `initialize_element`, except in the case of `add`, which adds the item to the tree before styling it.
def style_and_context(element, element_id, &block) style_method = "#{element_id}_style" if parent_layout.respond_to?(style_method) || block_given? parent_layout.context(element) do if parent_layout.respond_to?(style_method) parent_layout.send(style_method) end if block_given? yield end end end end
[ "def render_style(&block)\n \"#{style}#{yield}\"\n end", "def render_style(&block)\n [ style.to_s, yield, parent_style ].join\n end", "def process_style(*args, &block)\n # Avoid #instance_exec if possible for ruby 1.8.\n evaluator = args.empty? ? :instance_eval : :instance_exec\n send(evaluator, *args, &block) if block\n end", "def apply_styles(*widget)\n widget = widget.first || Gas.main\n\n widget.style_context.add_provider(self.css, Gtk::StyleProvider::PRIORITY_USER)\n return unless widget.respond_to?(:children)\n widget.children.each{|x| apply_styles(x)}\n end", "def apply_to(obj)\n entries.each do |selector, style|\n obj.style.set(style) if selector[obj]\n end\n end", "def set_style\r\n @style = Style.new\r\n\r\n alignment_node = @node.xpath('.//w:jc').first\r\n alignment = alignment_node ? alignment_node.attributes['val'].value : nil\r\n @style.instance_variable_set('@text_align', alignment.to_sym) if alignment\r\n\r\n size_node = @node.xpath('w:pPr//w:sz').first\r\n font_size = size_node ? size_node.attributes['val'].value.to_i / 2 : nil\r\n @style.instance_variable_set('@font_size', font_size)\r\n\r\n bold_node = @node.xpath('w:pPr//w:b').first\r\n @style.instance_variable_set('@font_weight', 'bold') if bold_node\r\n\r\n italic_node = @node.xpath('w:pPr//w:i').first\r\n @style.instance_variable_set('@font_style', 'italic') if italic_node\r\n\r\n underline_node = @node.xpath('w:pPr//w:u').first\r\n @style.instance_variable_set('@text_underline_style', 'solid') if underline_node\r\n end", "def style(options); end", "def render_style\n \"#{style}#{yield}\"\n end", "def chain(&block)\n if block_given?\n @stylesheet.instance_exec(@stylesheet, &block)\n @parent.rules << to_s \n else \n self\n end\n end", "def render_style\n \"#{style}#{yield}\".freeze\n end", "def set_run_style(validator, attr, value); end", "def font_style(style)\n f = font\n if block_given?\n font(f.name, size: font_size, style: style) do\n yield\n end\n else\n font(f.name, size: font_size, style: style)\n end\n end", "def kss_block(section_id, options={}, &block)\n section = @styleguide.section(section_id)\n\n raise \"Section '#{section_id}' not found.\" unless section.filename\n\n options = DEFAULT_OPTIONS.merge(options)\n\n inner_style = ''\n inner_style = \"width: #{options[:width]}px; margin: 0 auto\" if options[:width]\n\n render \\\n partial: 'styleguides/block',\n locals: {\n canvas_class: %W(bg-#{options[:background]} align-#{options[:align]}),\n code_block: block,\n html: capture(&block),\n source: capture_source(section_id, block),\n source_language: source_language(block),\n section: section,\n modifiers: (section.modifiers rescue Array.new),\n options: options,\n inner_style: inner_style,\n }\n end", "def getStyleElement\n return @element\n end", "def css_proc\n @css_proc = Proc.new if block_given?\n @css_proc\n end", "def within_element(el, &block)\n element_node = get_element_node(el)\n\n raise \"No el in scope\" if element_node.nil?\n yield(CallScope.from_xml(self, element_node))\n end", "def apply anElement\r\n unless anElement \r\n return\r\n end\r\n anElement.each {|e| \r\n unless @abort\r\n handle(e)\r\n yield if block_given?\r\n end }\r\n end", "def on_element(&block)\n @callback_tree.add_callback(:element, @current_path, &block)\n end", "def process_text_list_style( element )\n\t\tmarker = [\"circle\", \"disc\", \"square\"];\n\t\tnumbering = {\"1\" => \"decimal\",\n\t\t\t\"a\" => \"lower-alpha\", \"A\" => \"upper-alpha\",\n\t\t\t\"i\" => \"lower-roman\", \"I\" => \"upper-roman\" }\n\n\t\tmain_name = element.attribute( \"#{@style_ns}:name\" ).value\n\t\telement.elements.each do |child|\n\t\t\tlevel = child.attribute(\"#{@text_ns}:level\").value\n\t\t\tselector = main_name + \"_\" + level\n\n\t\t\tif (child.name == \"list-level-style-bullet\")\n\t\t\t\tprocess_normal_style_attr( selector, \"list-style-type\",\n\t\t\t\t\tmarker[(level.to_i-1)%3] )\n\t\t\telsif (child.name == \"list-level-style-number\")\n\t\t\t\tprocess_normal_style_attr( selector, \"list-style-type\",\n\t\t\t\t\tnumbering[child.attribute(\"#{@style_ns}:num-format\").value] )\n\t\t\tend\n\t\tend\n\tend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the open and close times for the specified date or an empty array if closed on that date
def open_close_times(date) open_close = @open_close[as_string(date)] || @open_close[as_sym(date)] || @default_open_close open_close.collect { |h| Time.parse("#{as_string(date)} #{h}") } end
[ "def opening_time(date)\n closed?(date) ? nil : schedule(date)[0]\n end", "def open_slots_for_select(date)\n open_slots(date).map do |slot|\n [\"#{slot.starts_at.strftime('%d/%m/%Y, %H:%M ')}\", slot.starts_at]\n end\n end", "def closing_time(date)\n closed?(date) ? nil : schedule(date)[1]\n end", "def openings_on(date)\n events = openings.starts_on(date).to_a\n events.present? ? events : recurrent_openings_for(date)\n end", "def recurrent_openings_for(date)\n recurrence_date = openings.recurrent(date).maximum(:starts_at)\n recurrence_date ? openings.starts_on(recurrence_date).to_a : []\n end", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def open_appointment_times(date)\n appointments = self.appointments.given_date(date).confirmed\n increment = self.clinic.appointment_time_increment\n stop_time = 60 - increment\n times = []\n (9..16).each do |h|\n (0..stop_time).step(increment) do |m|\n ampm = ''\n if h < 12\n ampm = 'AM'\n else\n ampm = 'PM'\n end\n\n hr = ''\n if h != 12\n hr = h % 12\n else\n hr = h\n end\n min = ''\n if m == 0\n min = '00'\n else\n min = m\n end\n\n times.append(\"#{hr}:#{min} #{ampm}\")\n end\n end\n appointments.find_each do |appt|\n hour = appt.appointment_time_hour_24\n minute = appt.appointment_time_minute\n minute = '00' if minute == 0\n\n ampm = ''\n if hour < 12\n ampm = 'AM'\n else\n ampm = 'PM'\n end\n hour = hour % 12 if hour != 12\n if times.include?(\"#{hour}:#{minute} #{ampm}\")\n times.delete(\"#{hour}:#{minute} #{ampm}\")\n end\n end\n times\n end", "def opening_time_on(day)\n time = day\n hours = nil\n month_times = @times[time.month]\n if month_times.is_a? Hash then\n month_times.each_pair do |days_range, hours_for|\n if days_range.include? time.day then\n hours = hours_for\n break\n end\n end\n else\n hours = month_times\n end\n\n if weekend?(time) and hours != nil and hours.begin < @weekend_open then\n hours = (@weekend_open...hours.end)\n end\n\n return hours\n end", "def each_open_day\n each do |day, times|\n unless times.empty?\n yield day, times\n end\n end\n end", "def trucks_currently_open\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_open_now = []\n trucks.each do |truck|\n if date.strftime('%H:%M') <= truck[\"end24\"] && \n date.strftime('%H:%M') > truck[\"start24\"]\n trucks_open_now << truck[\"applicant\"]\n end \n end\n p trucks_open_now\n end", "def day_opening_slots(day_openings)\n available_day_slots = []\n\n day_openings.each do |o|\n (o.starts_at.to_i...o.ends_at.to_i).step(30.minutes) do |slot|\n the_slot = Time.at(slot).utc.to_datetime\n available_day_slots << the_slot unless available_day_slots.include?(the_slot)\n end\n end\n\n available_day_slots\n end", "def closed_date_time\n return @closed_date_time\n end", "def grouped_open_hours\n\n open_hours = []\n start_day = nil\n end_day = nil\n current_period = nil\n\n standard_hours.sort.each_with_index do |o, i|\n if not o.open?\n period = \"Stengt\"\n else\n period = I18n.l(o.open_time, format: :time) + \" - \" + I18n.l(o.close_time, format: :time)\n end\n\n # Track day\n if start_day == nil\n start_day = o.day\n current_period = period\n end\n\n # Previous group ended, add it\n if period != current_period\n day = I18n.t(\"days.#{start_day}\")\n if end_day != nil\n day += \" - \" + I18n.t(\"days.#{end_day}\")\n end\n # Hverdager custom string\n if start_day == \"monday\" and end_day == \"friday\"\n day = \"Hverdager\"\n end\n open_hours.append([day, current_period])\n current_period = period\n start_day = o.day\n end_day = nil\n end\n\n # Update period end\n if start_day != o.day\n end_day = o.day\n end\n\n # Last day closes period\n if i >= standard_hours.count - 1\n day = I18n.t(\"days.#{start_day}\")\n if end_day != nil\n day += \" - \" + I18n.t(\"days.#{o.day}\")\n end\n open_hours.append([day, current_period])\n end\n\n end\n\n open_hours\n end", "def closed?(date)\n schedule(date).empty?\n end", "def getReleasedHours (openingHour, date)\n releasedHours = []\n tempHour = openingHour.from\n interval = openingHour.company.schedule_interval\n\n # Enquanto o tempHour estiver no intervalo do OpeningHour e o interval for maior que 0 vai incrementando o tempHour\n while tempHour.between?(openingHour.from, openingHour.to) && interval > 0 do\n releasedHours << Time.zone.local(date.year, date.month, date.day, tempHour.hour, tempHour.min, tempHour.sec)\n tempHour += interval\n end\n\n return releasedHours\n end", "def closed?(time)\n @closed_days.each { |day| return true if BusinessHours.same_day?(day, time) }\n @specific_hours.each { |day| return true if BusinessHours.same_day?(day, time) && time.clock_is_after?(Time.parse(hours[1])) }\n time.clock_is_after?(Time.parse(@normal_hours[1]))\n end", "def closed_sprint_times\n per_page = 50\n offset = 0\n path = \"rest/agile/1.0/board/#{JIRA_BOARD_ID}/sprint?maxResults=#{per_page}\"\n sprints = []\n data, status = parse_json(request(path: path))\n loop do\n sprints += data['values'].select { |s| s['state'] == 'closed' }\n break if data['isLast'] || status != '200'\n\n offset += per_page\n data, status = parse_json(request(path: \"#{path}&startAt=#{offset}\"))\n end\n # sort by startDate and map to [startDate, endDate]\n times = sprints.sort_by { |s| s['startDate'] }.map do |s|\n [DateTime.parse(s['startDate']), DateTime.parse(s['endDate'])]\n end\n # ensure there are no gaps\n times.each_with_index do |time, idx|\n next_time = times[idx + 1]\n time[1] = next_time[0] if next_time\n end\n times\n end", "def show_opening_hours(times, formatted_times, event_date)\n result = 'Not Open Today'\n event_day = transformToFourSquareDay(event_date.in_time_zone.wday)\n times.each_with_index do |time, index|\n unless time.days.index(event_day).nil?\n result = formatted_times[index].open[0].renderedTime\n end\n end\n result\n end", "def date_regions\n times = eventdates.collect{|dt| [dt.startdate, dt.enddate]}.flatten().uniq().sort();\n dates = eventdates().sort_by{|k| k.startdate};\n\n contents = [];\n working_set = [];\n headers = [];\n\n times.each do |time|\n working_set.reject! {|date| !((date.startdate <= time) && (date.enddate > time))};\n\n while(!dates.empty? && (dates.first.startdate <= time) && (dates.first.enddate > time))\n working_set << dates.shift();\n end\n \n if(!working_set.empty?)\n headers << time;\n contents << Array.new(working_set);\n end\n end\n\n return headers, contents;\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the length of time available during a specified day to do work e.g., there are 6 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 9:00 AM there are 5 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 10:00 AM
def work_time(date) open, closed = open_close_times(date) closed - open - time_already_open(date) end
[ "def working_day_duration_minutes\n ((self.working_day_end_time - self.working_day_start_time) / 60).to_i\n end", "def working_duration\n (start_date && due_date) ? working_days(start_date, due_date) : 0\n end", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def min_available_talks_time_in_a_day\n 6*60\n end", "def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end", "def day_length day_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def hours_worked(shift)\n start_time_minutes = shift.start.strftime(\"%H\").to_i * 60 + shift.start.strftime(\"%M\").to_i\n end_time_minutes = shift.finish.strftime(\"%H\").to_i * 60 + shift.finish.strftime(\"%M\").to_i\n if start_time_minutes > end_time_minutes\n total = 1440 - start_time_minutes + end_time_minutes - shift.break_length\n else\n total = end_time_minutes - start_time_minutes - shift.break_length\n end\n return (total/60.to_f).round(2)\n end", "def night_length night_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def calculate_hours_due\n case date.wday\n when 6, 0\n # Saturday and sunday are off\n 0.0\n else\n # Assume same working hours during the week\n daily_workload\n end\n end", "def length_of_stay\n (self.date_end.to_date - self.date_start.to_date).to_i - 1\n end", "def get_total_occupiable_time(fleet_size, start_date, end_date)\n time = ((end_date.to_time.to_i - start_date.to_time.to_i)/1.day.to_i) * fleet_size\n\n time == 0 ? fleet_size : time\n\n end", "def opening_time_on(day)\n time = day\n hours = nil\n month_times = @times[time.month]\n if month_times.is_a? Hash then\n month_times.each_pair do |days_range, hours_for|\n if days_range.include? time.day then\n hours = hours_for\n break\n end\n end\n else\n hours = month_times\n end\n\n if weekend?(time) and hours != nil and hours.begin < @weekend_open then\n hours = (@weekend_open...hours.end)\n end\n\n return hours\n end", "def length_in_hours\n length_in_minutes / 60\n end", "def run_length\n (end_date || Date.today) - start_date if start_date && start_date.past?\n end", "def calculate_worktime\n times = retrieve_worktime\n if (times[:over] > 0)\n time = times[:over]\n else\n time = times[:during] + times[:into] + times[:beyond]\n end\n \"Worktime:; #{time} h\"\n end", "def duration_length(checkin, checkout)\n duration = 0\n unless checkout.nil?\n duration = (checkout.checkout_time - checkin.checkin_time) / 1.hour\n duration = duration.round(2)\n end\n duration\n end", "def run_length\n (end_date || Date.today) - start_date if start_date\n end", "def remaining_time\n distance_of_time_in_words promised_for, Time.now\n end", "def working_duration\n return nil unless done_at && started_at\n done_at - started_at\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
advance the specified date by 24 hours
def next_day(date) date + (60 * 60 * 24) end
[ "def next_hourly\n @current_date += @interval.hours\n end", "def advance(date, time)\n date.advance(hours: time.hour, minutes: time.min, seconds: time.sec)\n end", "def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end", "def advance_hours(hours)\n self + (hours * 60 * 60)\n end", "def advance_days(days)\n advance_to_date(to_date + days)\n end", "def advance()\n @date = @date + 1\n end", "def add_day(date,n)\n\n\n Time.new(date.year,date.month,date.day+n,date.hour,date.min,date.sec,\"-05:00\")\n\n\n end", "def advance(options)\n unless options[:weeks].nil?\n options[:weeks], partial_weeks = options[:weeks].divmod(1)\n options[:days] = options.fetch(:days, 0) + 7 * partial_weeks\n end\n\n unless options[:days].nil?\n options[:days], partial_days = options[:days].divmod(1)\n options[:hours] = options.fetch(:hours, 0) + 24 * partial_days\n end\n\n d = to_date.gregorian.advance(options)\n time_advanced_by_date = change(year: d.year, month: d.month, day: d.day)\n seconds_to_advance = \\\n options.fetch(:seconds, 0) +\n options.fetch(:minutes, 0) * 60 +\n options.fetch(:hours, 0) * 3600\n\n if seconds_to_advance.zero?\n time_advanced_by_date\n else\n time_advanced_by_date.since(seconds_to_advance)\n end\n end", "def add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @time.hour\n next_hour = cur_hour + hours\n \n if next_hour >= 24\n @time = self.add_days(1).stamp(:datet => false, :hour => 0)\n hours_left = (hours - 1) - (24 - cur_hour)\n return self.add_hours(hours_left) if hours_left > 0\n elsif next_hour < 0\n @time = self.add_days(-1).stamp(:datet => false, :hour => 23)\n hours_left = hours + cur_hour + 1\n self.add_hours(hours_left) if hours_left < 0\n else\n @time = self.stamp(:datet => false, :hour => next_hour)\n end\n \n return self\n end", "def next_day\n advance(days: 1)\n end", "def adjusted(hour)\n (hour + (24 - WORK_START)) % 24\n end", "def tomorrow(x = 1)\n\t\tself + (86400 * x)\n\tend", "def add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @t_hour\n next_hour = cur_hour + hours\n \n if next_hour >= 24\n @t_hour = 0\n self.add_days(1)\n hours_left = (hours - 1) - (24 - cur_hour)\n self.add_hours(hours_left) if hours_left > 0\n elsif next_hour < 0\n @t_hour = 23\n self.add_days(-1)\n hours_left = hours + cur_hour + 1\n self.add_hours(hours_left) if hours_left < 0\n else\n @t_hour = next_hour\n end\n \n return self\n end", "def next_date!\n Kernel.loop do\n @date += 1.day\n return if possible?\n end\n end", "def next_show_date\n interval = SATURDAY - Date.today().wday\n interval = SATURDAY if (interval < 0)\n\n Date.today + interval\n end", "def hour=(newhour)\n newhour = newhour.to_i\n day = @time.day\n \n loop do\n break if newhour >= 0\n day += -1\n newhour += 24\n end\n \n loop do\n break if newhour < 24\n day += 1\n newhour += -24\n end\n \n @time = self.stamp(:datet => false, :hour => newhour)\n \n self.date = day if day != @time.day\n return self\n end", "def days() 24 * hours end", "def add_day(day)\n # day = Time.parse(date_string).to_date\n next_day = day.midnight + 1.day\n return next_day\n end", "def next_hour\n (Time.now + 3600).strftime(\"%I\").to_i\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use imageserver and blob csid to serve audio
def render_audio_csid options={} # render audio player content_tag(:div) do options[:value].collect do |audio_csid| content_tag(:audio, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 audio in MPEG format.", src: "https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{audio_csid}/content", id: 'audio_csid', type: 'audio/mpeg'), controls: 'controls', style: 'height: 60px; width: 640px;') end.join.html_safe end end
[ "def audio_url(path); end", "def audio_url(source, options = T.unsafe(nil)); end", "def streaming_url\n audio_url(self, :format => :mp3)\n end", "def download\n @audio = Audio.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@audio.audio.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "def audio_rec\n\n end", "def link\n if @mix_track = MixTrack.find_by_id(params[:id])\n send_file @mix_track.attachment.path, :type => 'audio/mp3', :disposition => 'attachment'\n else\n render :nothing => true\n end\n end", "def main_audio ; end", "def gsm_audio\n @prompt_blog = DataGatewayPromptBlob.find params[:id]\n render :text => @prompt_blog.binary, :content_type => \"audio/x-gsm\"\n end", "def send_thumbnail\n response.set_header('Access-Control-Allow-Origin', '*')\n response.headers[\"Last-Modified\"] = Time.now.httpdate.to_s\n response.headers[\"Content-Type\"] = 'image/jpeg'\n response.headers[\"Content-Disposition\"] = 'inline'\n path = Hyrax::DerivativePath.derivative_path_for_reference(identifier, 'thumbnail')\n begin\n IO.foreach(path).each do |buffer|\n response.stream.write(buffer)\n end\n ensure\n response.stream.close\n end\n end", "def display\n @audio = Audio.find(params[:audio_id])\n send_file @audio.url_url.to_s, :disposition => 'inline', :stream => true, :file_name => @audio.title\n end", "def wav\n \"https://#{@connection.address}#{@uri}.wav\"\n end", "def track_image\n\t\t# Get the required parameters\n\t\tmusic_id = params[:music_id]\n\t\t\n\t\t# Find the music within the database\n\t\tmusic = Music.find_by(id:music_id)\n\t\t\n\t\t# If such a song exists return its image path\n\t\tresponse = \"#{music.image_path}\"\n\t\trender :text => response and return\n\tend", "def send_audio_message(recipient_id)\n message_data = {\n recipient: {\n id: recipient_id\n },\n message: {\n attachment: {\n type: 'audio',\n payload: {\n url: SERVER_URL + '/assets/sample.mp3'\n }\n }\n }\n }\n\n call_send_api(message_data)\nend", "def wav\n \"https://#{@connection.address}#{@path}.wav\"\n end", "def tplayer\n @embed = params[:embed] ? true : false\n @file_id = params[:file_id]\n @audio_file = AudioFile.find(@file_id)\n may_read = true\n if !@audio_file.item.is_public\n logger.warn(\"private item\");\n if current_user\n ability = Ability.new(current_user)\n if !ability.can?(:read, @audio_file.item)\n logger.warn(\"current_user may not read\")\n may_read = false\n end\n else\n logger.warn(\"no current_user\")\n may_read = false\n end\n end\n if !may_read\n respond_to do |format|\n format.html {\n render :formats => [:html], :file => File.join(Rails.root, 'public', '403'), :status => 403\n }\n format.json {\n render :text => { :error => \"permission denied\", :status => 403 }.to_json, :status => 403\n }\n end\n return\n end\n @mp3 = @audio_file.url(:mp3)\n @ogg = @audio_file.url(:ogg)\n @transcript = @audio_file.best_transcript\n @title = params[:title] || @audio_file.item.title\n @chunk_size = params[:chunk] || 30\n @start = params[:start] || 0\n @end = params[:end] || false\n\n respond_to do |format|\n format.html {\n render :formats => [:html]\n }\n format.json {\n render :json => {\n file_id: @file_id,\n mp3: @mp3,\n ogg: @ogg,\n title: @title,\n start: @start,\n end: @end\n }.to_json, :callback => params[:callback]\n }\n end\n end", "def audio\n redirect_to @moment.cached_audio_url\n end", "def audio\n first_stream_of :audio\n end", "def audio\r\n redirect_to @moment.cached_audio_url\r\n end", "def record_audio()\r\n file_name = Time.now.to_s\r\n stdout, status = Open3.capture2(\"arecord -D hw:1,0 -d 8 -f cd #{file_name}.wav -c 1\")\r\n return file_name\r\nend" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use imageserver and blob csid to serve video
def render_video_csid options={} # render video player content_tag(:div) do options[:value].collect do |video_csid| content_tag(:video, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.", src: "https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{video_csid}/content", id: 'video_csid', type: 'video/mp4'), controls: 'controls', style: 'width: 640px;') end.join.html_safe end end
[ "def render_video_csid options = {}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_csid|\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://webapps.cspace.berkeley.edu/bampfa/imageserver/blobs/#{video_csid}/content\",\n id: 'video_csid',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end", "def video_url(path); end", "def download_video\n\t\t# preview_video_url = \"https://video.tvspielfilm.de/ivideo/video/10/9700610_1.mp4\"\n\n\t\tif preview_video_url.present?\t\n\t\t\tfilename = Pathname.new(preview_video_url).basename\n\t\t\tfilename = filename.to_s rescue \"#{Time.now.to_i}.mp4\"\n\t\t\t\n\t\t\tfilename = \"#{id}_#{filename}\"\n\n\t\t\tnew_file_path = \"#{Rails.root.to_s}/public/videos/#{filename}\"\n\t\t\topen(new_file_path, \"wb\") do |file| \n\t\t\t file.print open(preview_video_url).read\n\t\t\tend\n\t\t\tupload_video_at_s3(filename, new_file_path) \n\t\tend\n\tend", "def video_path(path); end", "def send_thumbnail\n response.set_header('Access-Control-Allow-Origin', '*')\n response.headers[\"Last-Modified\"] = Time.now.httpdate.to_s\n response.headers[\"Content-Type\"] = 'image/jpeg'\n response.headers[\"Content-Disposition\"] = 'inline'\n path = Hyrax::DerivativePath.derivative_path_for_reference(identifier, 'thumbnail')\n begin\n IO.foreach(path).each do |buffer|\n response.stream.write(buffer)\n end\n ensure\n response.stream.close\n end\n end", "def video_url(source, options = T.unsafe(nil)); end", "def video_url\n \"http://video.ted.com/#{videoID}\"\n end", "def local_video_player(video_id, opts = {})\n ogv = \"/videos/#{video_id}.ogv\"\n mp4 = \"/videos/#{video_id}.m4v\"\n return unless local_video_exists?(ogv) && local_video_exists?(mp4)\n defaults = {\n id: 'js_video_player',\n width: 510,\n height: 290,\n class: 'video-js vsj-default-skin',\n controls: true,\n preload: false,\n poster: '/assets/video_poster_image.png'\n }\n include_video_js_files\n content_tag :video, defaults.merge(opts) do\n \"<source src='#{mp4}' type='video/mp4'/>\n <source src='#{ogv}' type='video/ogg'/>\".html_safe\n end\n end", "def download\n @video = Video.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@video.video.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "def getVideoURL\n if (request.post?)\n cVideoID = self.findKeyInJSON(params[:params], \"VideoID\", 2)\n cOS = self.findKeyInJSON(params[:params], \"OS\", 2)\n \n case cOS.to_s\n when \"100\"\n # We have that file stored in S3 yet?\n # Check it later!\n # Just hard-code it\n returnFileName = \"http://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vods3/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n returnFileName += \"/playlist.m3u8\"\n when \"101\"\n # android\n returnFileName = \"rtsp://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vod/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n else\n # ignore\n end\n \n # Update Video Played Count\n begin\n b = Videotemp.find(cVideoID)\n if(b.playedCount == nil || b.playedCount == '')\n playedCount = 1\n else\n playedCount = b.playedCount\n playedCount = playedCount.to_i + 1\n end\n b.playedCount = playedCount.to_i\n b.save\n rescue Exception => e\n # ignore\n end\n \n # Return JSON response\n cRequestID = self.findKeyInJSON(params[:params], \"RequestID\", 1)\n rData = {\"VideoStreamUrl\" => returnFileName}\n self.jsonRender(rData, 'WOWZA URL', cRequestID, '100')\n end\n end", "def upload\n credentials = {}\n if @destinations\n @destinations.each_pair do |site, c| \n credentials.merge!(site => \"#{c[0]}:#{c[1]}\")\n end\n end\n \n result = HTTP.post(\"/video\", {\n :title => @title, \n :description => @description, \n :tags => @tags, \n :category => @category, \n :file => @file, \n :url => @url, \n :ping => @ping,\n :watermark_image_url => @watermark_image_url,\n :watermark_position => @watermark_position,\n :convert => @convert,\n :stat => @stat\n }.merge(credentials)\n )\n \n Video.new(Video.hpricot_to_hash(result))\n end", "def serve(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('fileasset', 'serve', kparams);\n\t\t\treturn client.get_serve_url();\n\t\tend", "def streaming_video_url\n # TODO figure out how to remove the need for this stupid hack\n # paperclip adds the cache buster to the URL automatically, I need\n # it to go away, probably a really easy paperclip option, but not\n # finding it at the moment.\n unless streaming_video.nil?\n streaming_video.data.url.split(\"?\")[0]\n else\n nil\n end\n end", "def harvest_video_data(image)\n response = Typhoeus.get(image.video_url, followlocation: true)\n\n if response.success?\n raise \"Invalid content type: \" + response.headers['Content-Type'] unless (response.headers['Content-Type'] == 'video/mp4')\n elsif response.timed_out?\n raise \"Request timed out\"\n elsif response.code == 0\n raise \"Could not get an HTTP response\"\n else\n raise \"HTTP request failed: \" + response.code.to_s\n end\n\n response.body\n end", "def video_url(opts={})\n if original_file_name\n file = opts[:format].nil? ? original_file_name : original_file_name.sub(/\\.[^.]+$/, \".#{opts[:format].to_s}\")\n \"#{media_host}/video/#{file}\"\n end\n end", "def thumbnail_video(talk)\n video = talk['video']\n return nil if video.nil?\n id = CGI.parse(URI.parse(video).query)['v'][0]\n \"https://img.youtube.com/vi/#{id}/0.jpg\"\n end", "def video_pic(new_path,basepath)\n options = {\n :input_file => basepath,\n :output_file => new_path + \".jpg\",\n }\n extract_image(new_path,options,\"video\")\n end", "def addWebCam()\n pathToWebcam = \"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/video/webcams.webm\"\n pathToIntermediates= \"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n\n # resize the webcam video\n puts \" Resizing webcam recording \"\n system \"ffmpeg -i #{pathToWebcam} -vcodec libx264 -vf scale=200:-1 #{pathToIntermediates}/webcamResized.mp4 -loglevel quiet\"\n \n # create a directory to store the final video(inside the published)\n pathToCompleteRecording=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/completeVideo\"\n createDirectoryIfNotExists(pathToCompleteRecording)\n\n puts \"Adding webcam into final video\"\n #merge it with the presentation+deskshare video\n system \"ffmpeg -i #{pathToIntermediates}/output.mp4 -i #{pathToIntermediates}/webcamResized.mp4 -filter_complex \\' overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10 \\' #{pathToCompleteRecording}/finalcut.mp4 -loglevel quiet\"\n end", "def convert_video_to_AVI(filename, path, content, url)\n logger.debug \"Convert the video ( #{filename} ) path ( #{path}) from content type of #{content} to H264\"\n File.new(File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.avi\"), File::CREAT | File::TRUNC| File::RDWR, 0644)\n videoavi = File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.avi\")\n system(\"ffmpeg -i #{url} -acodec copy -vcodec copy #{videoavi} -y\")\n return videoavi\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
serve X3D directy via apache (apache needs to be configured to serve nuxeo repo)
def render_x3d_directly options={} # render x3d player content_tag(:div) do options[:value].collect do |x3d_md5| l1 = x3d_md5[0..1] l2 = x3d_md5[2..3] content_tag(:video, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.", src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{x3d_md5}", id: 'x3d_md5', type: 'model/x3d+xml'), controls: 'controls', style: 'width: 640px;') end.join.html_safe end end
[ "def render_x3d_directly options = {}\n # render x3d player\n content_tag(:div) do\n options[:value].collect do |x3d_md5|\n l1 = x3d_md5[0..1]\n l2 = x3d_md5[2..3]\n content_tag(:x3d,\n content_tag(:scene,\n content_tag(:inline, '',\n url: \"https://cspace-prod-02.ist.berkeley.edu/bampfa_nuxeo/data/#{l1}/#{l2}/#{x3d_md5}\",\n class: 'x3d',\n type: 'model/x3d+xml')),\n style: 'margin-bottom: 6px; height: 660px; width: 660px;')\n end.join.html_safe\n end\n end", "def x_accel_redirect(filename, options = {})\n options.reverse_update(\n :disposition => 'inline',\n :content_type => 'application/octet-stream',\n :cache_control => 'private')\n\n response.headers['Content-Disposition'] = options[:disposition]\n response.headers['Content-Type'] = options[:content_type]\n response.headers['Cache-Control'] = options[:cache_control]\n\n case request.server_software\n when /apache/\n response.headers['X-Sendfile'] = File.join(RAILS_ROOT, 'public', filename)\n head :ok\n when /nginx/\n response.headers['X-Accel-Redirect'] = filename\n head :ok\n else\n send_file File.join(RAILS_ROOT, 'public', filename),\n :type => options[:content_type], :disposition => options[:disposition]\n end\n end", "def public_file_server; end", "def start\n ctl_proxy('start','httpd started')\n end", "def serve(file)\n sleep 0.1 until running?\n asset_id = App.settings[:assets][file]\n\n \"http://#{private_ip}:#{@port}/assets/#{asset_id}\"\n end", "def static_preview(options={})\n #build_dir = options[:build_dir] || settings.build_dir\n #system \"thin start -A file -c #{build_dir}\"\n StaticServer.run(options)\n end", "def static_preview(options={})\n #build_dir = options[:build_dir] || settings.build_dir\n #system \"thin start -A file -c #{build_dir}\"\n Static::Server.run(options)\n end", "def xrds\n render 'xrds', :content_type => 'application/xrds+xml', :layout => false\n end", "def serve!\n if TinyProxy::Cache.has? request.uri\n serve_from_cache!\n else\n serve_from_remote!\n end\n end", "def public_file_server=(_arg0); end", "def asset_proxy_host; end", "def serve(open_browser)\n\n if !File.exists? 'build/app.html'\n puts 'No WebAssembly app built!'\n exit\n end\n\n if open_browser\n open_cmd = 'open'\n\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = 'start'\n end\n\n Thread.new do\n sleep 2\n `#{open_cmd} http://localhost:8000/app.html`\n end\n end\n\n `ruby -run -ehttpd ./build -p8000`\nend", "def serve options\n server = WEBrick::HTTPServer.new :Port => options[:port]\n server.mount '/', Oaf::HTTPHandler, options\n trap 'INT' do server.shutdown end\n server.start\n end", "def sitemap_www\n render :file=>Rails.root.join(*%w( sitemap_www.xml)), :content_type => 'application/xml', :layout => false\n end", "def run\n check_for_web_build\n build_development\n listener = Listen.to(File.join(absolute_path, 'web')) do |_mod, _add, _rem|\n build_development\n end\n listener.start\n # @todo Get the public folder from a config?\n Gamefic::Sdk::Server.run! source_dir: absolute_path, public_folder: File.join(absolute_path, 'builds', 'web', 'development')\n end", "def start_httpd( config_file )\n\t\t#$stderr.close\n\t\t#$stderr.reopen( $stdout )\n\n\t\tconfig_file = File.expand_path( config_file )\n\n\t\tcommand = [ @exe, '-F', '-f', config_file ]\n\t\t$stderr.puts \"Starting server with: #{command.join(' ')}\" if $DEBUG\n\t\texec( *command )\n\tend", "def get index_dir, url\n xtractr = nil\n xtractr = xtractr_for index_dir\n xtractr.get url\n end", "def enable_daemon_serve\n @git.fs_write(DAEMON_EXPORT_FILE, '')\n end", "def apache_server\n package \"apache2-mpm-worker\", :ensure => :installed\n service \"apache2\", :require => package(\"apache2-mpm-worker\"), :restart => '/etc/init.d/apache2 restart', :ensure => :running\n a2enmod('rewrite')\n a2enmod('status')\n a2enmod('expires')\n if configuration[:ssl]\n a2enmod('headers')\n a2enmod('ssl')\n end\n if configuration[:apache][:gzip]\n a2enmod('deflate')\n end\n\n if configuration[:apache][:users]\n htpasswd = configuration[:apache][:htpasswd] || \"#{configuration[:deploy_to]}/shared/config/htpasswd\"\n \n file htpasswd, :ensure => :file, :owner => configuration[:user], :mode => '644'\n \n configuration[:apache][:users].each do |user,pass|\n exec \"htpasswd #{user}\",\n :command => \"htpasswd -b #{htpasswd} #{user} #{pass}\",\n :unless => \"grep '#{user}' #{htpasswd}\"\n end\n end\n\n apache2_conf = template(rails_template_dir.join('apache2.conf.erb'), binding)\n file '/etc/apache2/apache2.conf',\n :ensure => :present,\n :content => apache2_conf,\n :mode => '644',\n :require => package('apache2-mpm-worker'),\n :notify => service('apache2')\n\n status = <<-STATUS\n<IfModule mod_status.c>\nExtendedStatus On\n<Location /server-status>\n SetHandler server-status\n order deny,allow\n deny from all\n allow from 127.0.0.1\n</Location>\n</IfModule>\nSTATUS\n\n\n\n file '/etc/apache2/mods-available/status.conf',\n :ensure => :present,\n :mode => '644',\n :require => exec('a2enmod status'),\n :content => status,\n :notify => service(\"apache2\")\n file '/etc/logrotate.d/varlogapachelog.conf', :ensure => :absent\n\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a field and an array of child fields, we need to recurse through them to get the last one
def get_child_entity_from_path_by(field, children) # the next child in the path child_value = children.shift # get the child entity child = self.send(:children).find {|child| child.send(field) == child_value} if child && children.size > 0 # we have some recursion to do - we're not at the end of the array # so call this method again with a smaller set of children child.get_child_entity_from_path_by(field, children) else return child #this is the final thing in the array - return it end end
[ "def last_field(*args)\n fields(*args)[-1]\n end", "def getNestedField(doc, field)\n subdoc = doc\n field.split('.').each { |fieldpart|\n subdoc = subdoc[fieldpart] unless subdoc==nil\n }\n return subdoc;\nend", "def getFieldWithSubfields(fields)\n f = fields.sample(1).first\n if f[1][:subfields].nil? or f[1][:subfields].count < 2\n return getFieldWithSubfields(fields)\n end\n return f\nend", "def get_fields_or_build(field)\n unless field.is_a? DelegationField\n field_slug = field.to_s\n field = DelegationField.where(slug: field_slug).first\n return nil if field.nil?\n end\n field_values = get_fields(field)\n if field_values.empty?\n field_values = [self.fields.build(delegation_field_id: field.id)]\n end\n field_values\n end", "def reverse_each(&blk)\n fields.reverse_each do |field|\n if field.child?\n val = self.send(field.reader)\n yield val unless val.nil?\n end\n end\n return self\n end", "def get_field_value(row, field)\n value = nil\n\n row[\"Hierarchy\"].each do |artifact|\n if value.nil?\n value = artifact[field]\n end\n end\n return value\nend", "def get_fields\n ids = self.get_all_parent_ids\n ids << 0\n \n return DomainField.find(:all, :conditions => \"domain_id IN(#{ids.join(',')})\")\n end", "def merged_fields(new_field)\n field_ids = []\n merged_fields = fields.each_with_object([]) do |field, fields|\n field.deep_merge!(new_field) if field.id == new_field.id\n fields << field\n field_ids << field.id\n end\n merged_fields << new_field unless field_ids.include?(new_field.id)\n merged_fields\n end", "def field_sibling(field)\n sibling = @records.find do |rd|\n rd[:message_name] == field.global_message[:name] &&\n rd[:fields].keys.include?(field.name)\n end\n\n sibling && sibling[:fields][field.name][:value]\n end", "def extracted_sub_object(sub_objects, last_attribute)\n return sub_objects unless sub_objects.is_a?(Array)\n\n # On the last attribute wizard page index uses the default name, so don't pass down the class name\n class_name = sub_objects.first.class.name unless last_attribute\n index = wizard_object_index(class_name)\n\n sub_objects[index - 1]\n end", "def field_ancestor\n ancestors[1..].find(&:field_struct?)\n end", "def last *a; self.child(*a) + ':last-child' end", "def select_last_field\n raise\n return nil if @active_index.nil? # for forms that have no focusable field 2009-01-08 12:22 \n i = @focusables.length -1\n select_field i\n end", "def normalize_output_field(output_data, fields_list, field_name)\n return nil if output_data.nil?\n field_definition = get_field_by_name(fields_list, field_name)\n field_sym = field_name.to_sym\n output_data[field_sym] = normalize_type(output_data[field_sym],\n field_definition)\n\n sub_type = get_service_registry.get_type_signature(\n field_definition[:type])\n if sub_type\n sub_type[:fields] += implode_parent(sub_type)\n if sub_type[:fields]\n # go recursive\n sub_type[:fields].each do |sub_type_field|\n if output_data[field_sym].is_a?(Array)\n items_list = output_data[field_sym]\n output_data[field_sym] = []\n items_list.each do |item|\n output_data[field_sym] <<\n normalize_output_field(item, sub_type_field,\n sub_type_field[:name])\n end\n else\n output_data[field_sym] =\n normalize_output_field(output_data[field_sym], sub_type_field,\n sub_type_field[:name])\n end\n end\n end\n end\n return output_data\n end", "def recursive_demongoize(field_name, value, is_translation)\n field = klass.traverse_association_tree(field_name)\n demongoize_with_field(field, value, is_translation)\n end", "def unpack_field!(field)\n return if field.values.size == 1\n field.unpacked.each {|f| add_field(f) }\n delete_field(field)\n end", "def last_inquired(field)\n last = nil\n self.inquiries.reverse.each do |inquiry|\n last = inquiry.send(field)\n break if last\n end\n last\n end", "def process_child_item(field, classname)\n return if (!@data.has_key?(field) or @data[field].blank?)\n @data[field].each do |child_item_data|\n # Create a new child object using the class name passed to us\n child_item = Object.const_get(classname).new(@item_id, sort_field(field)) \n # Process the new child item\n child_item.process(child_item_data, @form_object)\n # We store all child objects in an array, add new object to array \n @child_items << child_item \n # Check for duplicate codes\n check_duplicate_codes(child_item)\n end\n end", "def sub_object\n splits= @field.split('.')\n object_name = splits.first\n field_names = splits[1..-1] # all but the first\n return unless object_name && obj.respond_to?(object_name)\n object = obj.send(object_name)\n # Its a collection => invoice.items and access is done by ary index:\n # first item => [items.1.name]\n if object.nil?\n # empty relation\n @result.gsub!(@placeholder, '')\n elsif object.is_a?(Array) && ary_index = field_names.first[/\\A\\d*\\z/]\n field_names.delete_at(0) # remove entry from field_names ary\n # replace with empty string if the index does not exist or obj is empty\n @result.gsub!(@placeholder, '') unless object = object[ary_index.to_i-1]\n end\n\n # Recurse and let the referenced object do the expanding\n if object.respond_to?(:expand_placeholders)\n value = object.expand_placeholders(\"[#{field_names.join('.')}]\")\n @result.gsub!(@placeholder, value)\n end\n end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a field (and optional delimiter), return a path to the current object. e.g. you'd end up with /path/to/page (where this object is 'page')
def nested_path_by(field, opts = {}) options = {delimiter: "/", prefix: ""} options.merge!(opts) delimiter = options[:delimiter] prefix = options[:prefix].empty? ? "" : "#{options[:prefix]}#{delimiter}" path = ([self] + ancestors).reverse.collect {|a| a.send(field)}.join(delimiter).gsub(prefix,"") return delimiter + path end
[ "def field_path *fields\n FieldPath.new(*fields)\n end", "def path\n position = document.atomic_position\n position.blank? ? field : \"#{position}.#{field}\"\n end", "def path\n raise NWN::Gff::GffError, \"field not bound to a parent\" unless @parent\n parent_path = @parent.path\n if @parent.element && @parent.element.field_type == :list\n idx = @parent.element.field_value.index(@parent)\n parent_path + \"[#{idx}]/\" + field_label\n else\n parent_path + \"/\" + field_label\n end.gsub(%r{/+}, \"/\")\n end", "def specific_object_path(object_type, key, value, prefix: nil)\n path_prefix = prefix ? \"#{prefix}_\" : ''\n self.send(:\"#{path_prefix}#{object_type.gsub(' ', '_')}_path\", find_object(object_type, key, value))\nend", "def format_path(object)\n object.path.gsub('::', '_')\n end", "def get_path_delimiter\n return @payload.get_path(\"path_delimiter\"){\"/\"}\n end", "def path\n @object.path.to_s\n end", "def path_for(obj)\n url = url_for(obj)\n \"/#{url.split(\"/\",4)[3]}\"\n end", "def record_path(object, kind=nil)\n kind = (kind || @kind).to_s.singularize\n return self.send(\"#{kind}_path\", object)\n end", "def path\n\t\t\tr = @path.join('.')\n\t\t\tr += \".#{@prop}\" if defined? @prop\n\t\t\tr\n\t\tend", "def method_missing(method, *args)\n if method =~ /current_(.*)/\n return path_part( @parts[$1.to_sym] ) if @parts.has_key?($1.to_sym)\n end\n\n super\n end", "def [](value)\n return nil if value.nil?\n \n if not value.kind_of? String\n raise ArgumentInvalidTypeError.new 'value', value, String\n end\n \n current_path_part = self\n path_parts = value.split('.')\n counter = 1\n path_parts.each do |part|\n current_path_part = current_path_part.child_path_part(part)\n return nil if current_path_part.nil?\n end\n return current_path_part\n end", "def field_name(field)\n \"#{object_name}[#{field}]\"\n end", "def serialized_path(object); end", "def visit_const_path_field(node); end", "def get_field_val field, request\n field_path = field.split \".\"\n\n curr_submessage = request\n field_path.each do |curr_field|\n return nil unless curr_submessage.respond_to? curr_field\n curr_submessage = curr_submessage.send curr_field\n end\n\n return curr_submessage.to_s if curr_submessage\n end", "def get_filefield_path(loc)\n @browser.file_field(parse_location(loc)).value\n end", "def tree_path_column\n \"#{self.class.table_name}__#{path_tree_opts[:path_column]}\".to_sym\n end", "def split_path; end" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }